html - 表格中的标签重叠

标签 html css twitter-bootstrap html-table

我的标签有问题,如您在图片中所见,这些标签包含在表格中:

Label overlap the table row

表格行如何自动适应标签内容?

<table class="table">
   <tr>
     <td>
       <input type="radio" name="radio_1" id="radio_1_2" data-type="1" data-value="2" class="css-checkbox">
       <label for="radio_1_2" class="css-label radGroup1">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy</label>
     </td>
   </tr>
</table>

更新: 这是我的标签和单选按钮的 CSS:

input[type=radio].css-checkbox {
    position:absolute;
    z-index:-1000;
    left:-1000px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    height:1px; width:1px;
    margin:-1px;
    padding:0;
    border:0;
}

input[type=radio].css-checkbox + label.css-label {
    padding-left:21px;
    height:16px; 
    display:inline-block;
    line-height:16px;
    background-repeat:no-repeat;
    background-position: 0 0;
    font-size:16px;
    vertical-align:middle;
    cursor:pointer;

}

input[type=radio].css-checkbox:checked + label.css-label {
    background-position: 0 -16px;
}
label.css-label {
    background-image:url(../img/radio_button.png);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

最佳答案

我刚刚又看了一遍,现在我发现了问题所在。我删除了 vertical-align 属性,它工作正常。

我的新 CSS 现在是这样的:

input[type=radio].css-checkbox {
    position:absolute;
    z-index:-1000;
    left:-1000px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    height:1px; width:1px;
    margin:-1px;
    padding:0;
    border:0;
}

input[type=radio].css-checkbox + label.css-label {
    padding-left:21px;
    height:16px; 
    display:inline-block;
    line-height:16px;
    background-repeat:no-repeat;
    background-position: 0 0;
    font-size:16px;
    /*vertical-align:middle;*/
    cursor:pointer;

}

input[type=radio].css-checkbox:checked + label.css-label {
    background-position: 0 -16px;
}
label.css-label {
    background-image:url(../img/radio_button.png);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

关于html - 表格中的标签重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42245142/

相关文章:

jquery - overflow-x 和 overflow-y 在 chrome 中无法正常工作

css - 当尺寸缩小时,如何将位于搜索字段左侧的按钮保留在其下方?

jquery - 如果 <ul> 元素没有 <li> 元素,如何删除它们

html - 通过添加到 SASS 中的类名来嵌套 css 选择器

css - 悬停时无法使用背景位置

javascript - jquery 中的重构替换

javascript - 如何在特定坐标中定位 DIV?

twitter-bootstrap - Bootstrap 滚动 spy 不起作用

javascript - 将文本框的值添加到计数器

Python html 解析