如何使两个块元素(“块”,因为我想将背景图像应用到其中一个块元素)对齐(一个在左边,一个在右边),其中:
就像这样:
<div id="some_parent_element_with_fixed_width">
<div class="left">Here should be some text of varying length...</div>
<div class="right">Here should be displayed a x-repeat background image on the entire remaining width...</div>
</div>非常感谢任何跨浏览器的解决方案!汤姆
发布于 2010-10-02 11:58:01
在左侧元素上使用float:left,这将使其只占用其内容的大小。在右边的元素上使用overflow:hidden,它将自动使用空间的其余部分,因为块元素的width属性的缺省值是auto。
.left { float: left; }
.right { overflow: hidden; background: url(someimage.gif) repeat-x; }https://stackoverflow.com/questions/3845523
复制相似问题