Goal:
Text above the picture and it should be centered and middle(First row is text and the next row is picture)
Problem:
I have tried using clear:both, display: block or similar but it doesn't work.
What code am I missing?
Thank you!
#parent {
display: flex;
}
#test1,
#test2{
border-top: 1px solid black;
border-bottom: 1px solid black;
display: flex;
align-items: center;
justify-content: center;
background: white;
width: 200px;
height: 200px;
padding:15px 15px 15px 15px;
flex: 1;
}
#test1 {
border-left: 1px solid black;
border-right: 1px solid black;
-webkit-border-top-left-radius: 10px;
-webkit-border-bottom-left-radius: 10px;
-moz-border-radius-topleft: 10px;
-moz-border-radius-bottomleft: 10px;
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
}
#test2 {
border-right: 1px solid black;
-webkit-border-top-right-radius: 10px;
-webkit-border-bottom-right-radius: 10px;
-moz-border-radius-topright: 10px;
-moz-border-radius-bottomright: 10px;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
}
#test1:hover {
background-color:#DCDCDC;
}
#test1:visited {
text-decoration:none;
text-decoration: none;
text-decoration-color: none;
background-color:none;
color: none;
}
#test2:hover {
background-color:#DCDCDC;
}
<div id="parent">
<a href="#">
<div id="test1">
picture1
<img src="https://cdn3.iconfinder.com/data/icons/catcommerce-black/120/search-64.png" width="64" height="64">
</div>
</a>
<a href="#">
<div id="test2">
picture2
<img src="https://cdn3.iconfinder.com/data/icons/catcommerce-black/120/search-64.png" width="64" height="64">
</div>
</a>
</div>
Related
I've the below HTML Code in my document.
<div class="panel-body chat-box-main">
<div class="chat-box-left">Hello, Welcome!. You can ask me
questions on Compliance Policy ..</div>
<div class="chat-box-name-left">
<img src="compiler-bot-static.gif" alt="bootstrap Chat box user image"
class="img-circle"> - Bot
</div>
<hr class="hr-clas">
<div class="chat-box-right" id="chatbox">Hi</div>
<div class="chat-box-name-right">
<img src="smiley.jpg" alt="bootstrap Chat box user image"
class="img-circle">
</div>
<div class="chat-box-left">Hello</div>
<div class="chat-box-name-left">
<img src="compiler-bot-static.gif" alt="bootstrap Chat box user image"
class="img-circle">- Bot
</div>
</div>
And my CSS is as below.
.hr-clas {
border-top: 1px solid #A12EB3;
}
.chat-box-main {
height: 400px;
overflow-y: auto;
}
.chat-box-div {
border: 2px solid #A12EB3;
border-bottom: 2px solid #A12EB3;
}
.chat-box-head {
padding: 10px 15px;
border-bottom: 2px solid #A12EB3;
background-color: #B25AE5;
color: #fff;
text-align: center;
}
.chat-box-left {
width: 100%;
height: auto;
padding: 15px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
position: relative;
border: 1px solid #C5C5C5;
font-size: 12px;
border: 2px solid #73AD21;
border-radius: 25px;
}
.chat-box-left:after {
top: 100%;
left: 10%;
border: solid transparent;
content: " ";
position: absolute;
border-top-color: #C5C5C5;
border-width: 15px;
margin-left: -15px;
}
.chat-box-name-left {
margin-top: 30px;
margin-left: 60px;
text-align: left;
color: #049E64;
}
.chat-box-name-left img {
max-width: 40px;
border: 2px solid #049E64;
}
.chat-box-right {
width: 100%;
height: auto;
padding: 15px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
position: relative;
border: 1px solid #C5C5C5;
font-size: 12px;
}
.chat-box-right:after {
top: 100%;
right: 10%;
border: solid transparent;
content: " ";
position: absolute;
border-top-color: #C5C5C5;
border-width: 15px;
margin-left: -15px;
}
.chat-box-name-right {
color: #354EA0;
margin-top: 30px;
margin-right: 60px;
text-align: right;
}
.chat-box-name-right img {
max-width: 40px;
border: 2px solid #354EA0;
}
.chat-box-footer {
background-color: #D8D8D8;
padding: 10px;
}
Here my requirement is to automatically set the width of each box(div) as per the content entered and float them accordingly to left/right.
Currently my output is as below.
Here as seen in the above screenshot, though there is only one word in the div, it is taking the entire width. Please let me know on how can I limit this to the text width.
Thanks
try this https://plnkr.co/edit/KXF1jkOd7G9JB8j7DIGC
I have changed the div to span. Hope this helps !
<span class="chat-box-left">Hello, Welcome!. You can ask me
questions on Compliance Policy ..</span>
Are you looking some thing like this, Try this add display: inline-block; to div
.hr-clas {
border-top: 1px solid #A12EB3;
}
.chat-box-main {
height: 400px;
overflow-y: auto;
}
.chat-box-div {
border: 2px solid #A12EB3;
border-bottom: 2px solid #A12EB3;
}
.chat-box-head {
padding: 10px 15px;
border-bottom: 2px solid #A12EB3;
background-color: #B25AE5;
color: #fff;
text-align: center;
}
.chat-box-left {
width:auto;
height: auto;
padding: 35px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
position: relative;
border: 1px solid #C5C5C5;
font-size: 12px;
border: 2px solid #73AD21;
border-radius: 25px;
display: inline-block;
}
.chat-box-left:after {
top: auto;
left: 10%;
border: solid transparent;
content: " ";
position: absolute;
border-top-color: #C5C5C5;
border-width: 15px;
margin-left: -15px;
}
.chat-box-name-left {
margin-top: 30px;
margin-left: 60px;
text-align: left;
color: #049E64;
}
.chat-box-name-left img {
max-width: 40px;
border: 2px solid #049E64;
}
.chat-box-right {
width:auto;
height: auto;
padding: 35px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
position: relative;
border: 1px solid #C5C5C5;
font-size: 12px;
display: inline-block;
}
.chat-box-right:after {
top: 100%;
display: inline-block; right: 10%;
border: solid transparent;
content: " ";
position: absolute;
border-top-color: #C5C5C5;
border-width: 15px;
margin-left: -15px;
}
.chat-box-name-right {
color: #354EA0;
margin-top: 30px;
margin-right: 60px;
text-align: right;
}
.chat-box-name-right img {
max-width: 40px;
border: 2px solid #354EA0;
}
.chat-box-footer {
background-color: #D8D8D8;
padding: 10px;
}
<div class="panel-body chat-box-main">
<div class="chat-box-left">Hello, Welcome!. You can ask me
questions on Compliance Policy ..</div>
<div class="chat-box-name-left">
<img src="compiler-bot-static.gif" alt="bootstrap Chat box user image"
class="img-circle"> - Bot
</div>
<hr class="hr-clas">
<div class="chat-box-right" id="chatbox">Hi</div>
<div class="chat-box-name-right">
<img src="smiley.jpg" alt="bootstrap Chat box user image"
class="img-circle">
</div>
<div class="chat-box-left">Hello</div>
<div class="chat-box-name-left">
<img src="compiler-bot-static.gif" alt="bootstrap Chat box user image"
class="img-circle">- Bot
</div>
</div>
I want to design aggregation filter for week, month,etc. like following image. Please see the image, I want to design same-way
Image:image for which I want to design css
Please see the demo for DEMO
<style type="text/css">
.tag {
/*display: block;*/
border: 1px solid #4f9f4f;
padding: 6px 12px;
font: 12px/17px 'OpenSansLight';
color: #4f9f4f;
text-decoration: none;
}
.tag-leftmost {
border: 1px solid #4f9f4f;
border-bottom-left-radius: 20px;
border-top-left-radius: 20px;
padding: 6px 12px;
font: 12px/17px 'OpenSansLight';
color: #4f9f4f;
text-decoration: none;
}
.tag-rightmost {
border: 1px solid #4f9f4f;
border-bottom-right-radius: 20px;
border-top-right-radius: 20px;
padding: 6px 12px;
font: 12px/17px 'OpenSansLight';
color: #4f9f4f;
text-decoration: none;
}
.tag-center tag{
}
</style>
<div class="col-md-12 col-sm-12">
<a title="week? category" ng-model="today_placement" class="tag-leftmost">Today</a>
<a title="week? category" ng-model="week_placement" class="tag">week</a>
<a title="week? category" ng-model="month_placement" class="tag">month</a>
<a title="week? category" ng-model="year_placement" class="tag-rightmost">year</a>
</div>
Try using CSS triangles hack to make that arrow. Check .tag:hover:after
.wrapper {
border: 1px solid #4f9f4f;
border-radius: 20px;
padding: 0 14px;
float: left;
}
.tag {
padding: 6px 12px;
font: 12px/17px'OpenSansLight';
color: #4f9f4f;
text-decoration: none;
/* ADDED for :after */
position: relative;
float: left;
}
.tag:not(:first-child):not(:last-child) {
border-radius: 0;
border-left: 1px solid #4f9f4f;
border-right: 1px solid #4f9f4f;
}
.tag:hover {
background-color: red;
border-color: red;
}
.tag:hover:after {
content: '';
width: 0;
height: 0;
border: 5px solid transparent;
border-bottom-color: red;
position: absolute;
display: block;
left: 50%;
top: -10px;
margin-left: -5px;
}
<div class="wrapper col-md-12 col-sm-12">
<a title="week? category" class="tag">week</a>
<a title="week? category" class="tag">week</a>
<a title="week? category" class="tag">week</a>
</div>
I have a galery and I´m trying to crop the photos that have height more than 150px to have all images with the same height. Actually I have this --> http://postimg.org/image/9t605lhdv/
I would like to make something similar to this --> http://postimg.org/image/v1zjjwuyp/
For example this website have this "crop", but I can not get it seeing his css. --> http:// postimg.org/image/vq8e2utoh/
My html is:
<ul class="preview-grid container" id="preview-grid">
<li>
<a href="photo.jpg" data-largesrc="photo.jpg" data-title="photo-title" data-description="photo">
<img src="photo.jpg" alt="photo.jpg" class="img">
</a>
</li>
<li>
<a href="photo2.jpg" data-largesrc="photo2.jpg" data-title="photo-title" data-description="photo2">
<img src="photo2.jpg" alt="photo2.jpg" class="img">
</a>
</li>
<li>
<a href="photo3.jpg" data-largesrc="photo3.jpg" data-title="photo-title" data-description="photo">
<img src="photo3.jpg" alt="photo3.jpg" class="img">
</a>
<li>
<a href="photo4.jpg" data-largesrc="photo4.jpg" data-title="photo-title" data-description="photo4">
<img src="photo4.jpg" alt="photo4.jpg" class="img">
</a>
</li>
</ul>
and my css is:
.preview-grid {
list-style: none;
padding: 20px 0;
margin: 0 auto;
text-align: center;
width: 100%;
color: #d6d6d6;
}
.preview-grid li {
display: inline-block;
margin: 12px 10px;
vertical-align: top;
height: auto;
width: 22%;
}
.preview-grid li>a, .preview-grid li>a img {
border: none;
outline: none;
display: block;
position: relative;
width: 100%;
height: auto;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-right-radius: 15px;
-webkit-border-bottom-left-radius: 0;
-webkit-border-top-left-radius: 15px;
-moz-border-radius-topright: 0;
-moz-border-radius-bottomright: 15px;
-moz-border-radius-bottomleft: 0;
-moz-border-radius-topleft: 15px;
border-top-right-radius: 0;
border-bottom-right-radius: 15px;
border-bottom-left-radius: 0;
border-top-left-radius: 15px;
-moz-background-clip: padding-box;
-webkit-background-clip: padding-box;
background-clip: padding-box;
/* max-height: 136px; */
-webkit-box-shadow: 0 0 13px 0 #E8E8E8;
box-shadow: 0 0 13px 0 #E8E8E8;
}
I hope someone can help me!!
Thank you!!
Solved Here: Image As YOu Want
In Example The last6 image is cropped. as you asked in question!
Another hover effect if want to use Hover over effect
CSS Modified
.preview-grid {
list-style: none;
padding: 20px 0;
margin: 0 auto;
text-align: center;
width: 100%;
color: #d6d6d6;
}
.preview-grid li {
display: inline-block;
margin: 12px 10px;
vertical-align: top;
height: 150px;
width: 22%;
}
.preview-grid li>a, .preview-grid li>a img {
border: none;
outline: none;
display: block;
position: relative;
width: 150px;
height: 150px;
overflow:hidden;
border:1px solid yellow;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-right-radius: 15px;
-webkit-border-bottom-left-radius: 0;
-webkit-border-top-left-radius: 15px;
-moz-border-radius-topright: 0;
-moz-border-radius-bottomright: 15px;
-moz-border-radius-bottomleft: 0;
-moz-border-radius-topleft: 15px;
border-top-right-radius: 0;
border-bottom-right-radius: 15px;
border-bottom-left-radius: 0;
border-top-left-radius: 15px;
-moz-background-clip: padding-box;
-webkit-background-clip: padding-box;
background-clip: padding-box;
/* max-height: 136px; */
-webkit-box-shadow: 0 0 13px 0 #E8E8E8;
box-shadow: 0 0 13px 0 #E8E8E8;
}
.preview-grid li>a img {
width:100%;
height:auto;
}
I'm trying to build a facebook like Profile/Cover Layout, but i'm struggling with the correct layout.
What i have so far:
http://jsfiddle.net/kvEBF/
<div class="user_profile_cap">
<div class="user_profile_cover">
<img src="jpgfile" alt=""/>
</div>
<div class="user_profile_headline">
Pull Right Text
</div>
</div>
css
.user_profile_cap {
width: 970;
height: auto 9;
border: 1px solid #DDD;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.user_profile_cover {
img {
width: 970px;
height: 115px;
-webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
}
.user_profile_headline {
padding: 10px;
font-size: 16px;
}
http://jsfiddle.net/kvEBF/
The Desired Layout
I'm struggling on placing the Profile Picture, the Page Title and the Right Text correctly in to this Layout.
Can somebody help me out ?
Like this
working demo
css
.user_profile_cap {
width: 970;
height: auto 13;
border: 1px solid #DDD;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
overflow:hidden;
}
.user_profile_cover {
img {
width: 970px;
height: 115px;
-webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
}
.user_profile_headline {
padding: 10px;
font-size: 16px;
}
.user_profile_headline img{
border:1px solid #EEEEEE;
width:124px;
height:124px;
float:left;
margin:-90px 10px 0 0;
position:relative;
z-index:111;
background-color:white;
}
.user_profile_headline h2{
margin:0;
padding:0;
font-size:12px;
font-weight:bold;
display:block;
}
.user_profile_headline span{
font-size:10px;
font-family:verdana;
color:gray;
}
html:
<div class="no-contact-info">
<textarea></textarea>
<span>no contact info</span>
</div>
css:
.no-contact-info {
width: 400px;
}
.no-contact-info textarea {
width: 100%;
border-width: 1px;
border-style: solid;
border-right-color: #dbdfe6;
border-bottom-color: #e3e9ef;
border-left-color: #e7e8ed;
border-top-color: #abadb3;
z-index: 2;
}
.no-contact-info span {
display: block;
background:#FFFFC6 url(/media/icons/error.png) no-repeat 4px center;
padding: 2px 0 1px 24px;
color: #333333;
font-size: 12px;
font-weight: bold;
border: 1px solid #abadb3;
border-top-color: red;
width: 200px;
margin-top: -3px;
z-index: 1;
-webkit-border-bottom-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-moz-border-radius-bottomright: 4px;
-moz-border-radius-bottomleft: 4px;
border-bottom-right-radius: 4px;
}
view: http://jsfiddle.net/XurSz/
I want to push the "no contact info" span up slightly so that it covers the bottom border of the textarea... but the textarea keeps wanting to go overtop. How can I get around this?
The z-index property only affects elements that have been positioned. Adding position:relative; to the textarea and the span should do the trick.