html - 2 标签内 td 对齐

标签 html css

我在一个 td 中有 2 个标签,我正在尝试使对齐工作正常

这可能吗?

这是 Fiddle,用于解释相同的问题以及我的需求。

jsFiddle

 <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/

相关文章:

html - 替换清除 :both with pseudo class

javascript - 如何在节点后打印另一个 div 元素

css - CSS 粘性 header 的间隙问题(仅限移动设备)

javascript - 如果单选按钮适合一行,如何设置不同的样式?

html - 多个悬停状态的问题 - 不确定是相邻选择器还是兄弟选择器?

javascript - IE6 : width or height set to 0px does not work when content inside

html - 在文档片段中查找注释或文本节点

javascript - 此表的 jQuery 插件/库可简化代码

javascript - HTML5 Canvas drawImage 调整大小问题

html - 使用图层或 z-index 在 Canvas 上绘制形状/文本