跨浏览器CSS工作,允许左和右对齐文本在同一行?
示例(其中每个文本引文应尽可能左对或右对齐):
stuff on the right stuff on the left发布于 2010-07-24 10:25:07
带有容器标签:
<div>
<p style="float: left">stuff on the left</p>
<p style="float: right">Tstuff on the right </p>
</div>带有内联标记:
<div>
<span style="float: left">stuff on the left</span>
<span style="float: right">Tstuff on the right</span>
</div>发布于 2010-07-24 10:22:52
浮动:左代表左边,浮动:右边代表右边。或绝对/相对定位。很肯定这两种方法都能在主要的浏览器上运行。
发布于 2010-07-25 05:04:51
让我们假设这是HTML代码:
<div>
<div id="left" style="float: left">stuff on the left</div>
<div id="right" style="float: right">Tstuff on the right </div>
</div>您可以做的是使用JQuery找到最高的div,然后用最高的div设置#左、右的div。下面是一个示例代码:
if ($('#left').height()<$('#right').height()) {
$('#left').height($('#right').height());
} else {
$('#right').height($('#left').height());
}或者你可以用“等高jquery”搜索其他解决方案。
https://stackoverflow.com/questions/3324694
复制相似问题