我在外部有一个嵌套的div,宽度为100%.两个嵌套的div应该在一行中,并且首先应该从它的内容中获取它的大小:
<div id="#outer" style="width:100%; border:1px">
<div id="#inner1" style="border:1px; display:inline">
inner div 1. Some text...
</div>
<div id="#inner2" style="width:100%????; border:1px; display:inline">
inner div 2...
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
问题是如果没有指定#inner1 div的宽度并且取决于它里面的内容,如何使#inner2 div获得水平空间的其余部分?
PS在我的情况下,所有样式都在单独的类中,这里我将CSS放入样式属性只是为了简化.
我希望结果在IE7 +和FF 3.6中工作
对我来说更多细节看起来像这样:
<style type="text/css">
.captionText
{
float:left;
}
.captionLine
{
height: 1px;
background-color:black;
margin: 0px;
margin-left: 5px;
margin-top: 5px;
border: 0px;
padding: 0px;
padding-top: 1px;
}
</style>
<table style="width:300px;">
<caption width="100%">
<div class="captionText">Some text</div>
<div class="captionLine"> </div>
</caption>
<tr>
<td>something</td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
这是我想要的图像:
