我在一个 td 中有 2 个标签,我正在尝试使对齐工作正常
这可能吗?
这是 Fiddle,用于解释相同的问题以及我的需求。
<tr>
<td><label >Some Label Test:</label><label>Some Label Test:</label></td>
<td>
<label >Some Label Test:</label>
<label >here is the long test which exceeds the width and comes to second line but i want it like it should start below after test: instaead from some</label></td>
</tr>
如果长度很长,我会在里面寻找第二个标签,它会进入下一行并从第二个标签开始的地方开始。
最佳答案
这是一个简单的 div 用法,说明如何获得您想要的内容。 http://jsfiddle.net/KHAJz/3/
HTML
<div class="container">
<div class="first">Some Label Test:</div>
<div class="first">Some Label Test:</div>
<div class="first">Some Label Test:</div>
<div class="text">here is the long test which exceeds the width and comes to second line but i want it like it should start below after test: instead </div>
</div>
CSS
.container{
width:700px;
height:60px;
display:inline-block;
}
.first{
width:60px;
height:60px;
display:inline-block;
float:left;
}
.text{
width:300px;
display:inline-block;
float:left;
}
您要做的是制作一个容器,将所有东西放在一起,这样表格或 div 就不会到处都是。
关于html - 2 标签内 td 对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18915954/