我如何才能使floating-text
下面的div具有动态宽度,以便它填充图像旁边的空间?图片的宽度可以从100像素到400像素。
<div id="container">
<img src="image-can-be-from-100-to-400px-wide.jpg">
<div id="floating-text">
Text to be floated:left on right side of the image.
The width of this div needs to be dynamic,
so it will fill out the open space on the right side of the image above.
</div>
</div>
CSS:
#container {
width: 700px;
padding: 20px;
}
#floating-text {
margin-left: 20px;
float: left;
}
小提琴:http : //jsfiddle.net/51zstw6b/
给图像一个浮点数:向左移并删除浮点文本的浮点数。
的CSS
#container {
width: 500px; /*width adjusted for this fiddle demo*/
padding: 20px;
}
.img {
width: 200px;
float: left;
margin-right: 5px;
}
#floating-text {
margin-left: 20px;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句