As the title says
my code is something like this :
some text with line one, line two , line three <
-
position:relative
solves your problem
讨论(0)
-
I see no reason not to use position: absolute
.
See: http://jsfiddle.net/NeaR4/
CSS:
.container {
border: 2px dashed #444;
float: left;
position: relative
}
.container img {
display: block
}
.container > div {
position: absolute;
left: 0;
bottom: 0;
right: 0;
height: 14px;
background: #000;
background: rgba(0,0,0,0.7);
color: #fff;
overflow: hidden;
font: bold 14px Arial, sans-serif;
padding: 5px;
}
.container:hover > div {
height: auto
}
HTML:
<div class="container">
<img src="http://dummyimage.com/230x180/f0f/fff" />
<div>some text with line oneeee, line twoooooooo ooooooo , line three</div>
</div>
讨论(0)