简体   繁体   English

display:内联表等效crossbrower

[英]display: inline-table equivalent crossbrower

I have 2 radiobutton inside a <td> attribute in a HTML table. 我在HTML表格的<td>属性中有2个radiobutton。 They both have a <label> tag. 它们都有一个<label>标签。 As we know, the table tag doesnt have the attribute width, and I'm trying to find a crossbrowser solution to set a space between the labels of each radiobutton. 我们知道,表标签没有属性宽度,我正在尝试找到一个crossbrowser解决方案,在每个单选按钮的标签之间设置一个空格。

I have this code: 我有这个代码:

<td class="changeUnitsSetLabelWidth">
  <?php echo $form->radio("changeUnitsMode",UnitsTabComponent::SET_ALL_METRIC)->set("id","changeUnitsMode_metric") . $form->label("changeUnitsMode", "Metric")->set("for","changeUnitsMode_metric");
        echo $form->radio("changeUnitsMode", UnitsTabComponent::SET_ALL_IMPERIAL)->set("id","changeUnitsMode_imperial") . $form->label("changeUnitsMode", "Imperial")->set("for","changeUnitsMode_imperial");
  ?>
</td>

and I added the following line in my CSS: 我在CSS中添加了以下行:

.changeUnitsSetLabelWidth label{ display: inline-table; width: 80px;}

After searching on the internet, I found it doesnt work for IE7 (what a news!?!) so I'd like you to help me to find another way to do this display: inline-table, in a way I can set the width in the label. 在网上搜索后,我发现它对IE7不起作用(什么新闻!?!)所以我希望你帮我找另一种方法来做这个显示:inline-table,在某种程度上我可以设置标签中的宽度。

using display:inline-table does not make any sense here. 使用display:inline-table在这里没有任何意义。 Just set display:inline-block and set a width and a margin for the space between and you should be fine. 只需设置display:inline-block并设置宽度和间距,你应该没问题。

The IE7 hack for behaving like inline-block is: IE7黑客行为就像内联块一样:

 zoom: 1;
 *display: inline;

Try this: 试试这个:

.changeUnitsSetLabelWidth input,
.changeUnitsSetLabelWidth label {
    float: left;
}
.changeUnitsSetLabelWidth label {
    padding-left: 10px;
    padding-right: 10px;
    width: 80px;
}

The solution I found was changing it all and, instead of using inside a <td> attribute, I used it in a <div> <span> attribute and it worked well. 我找到的解决方案是更改所有内容,而不是在<td>属性中使用,我在<div> <span>属性中使用它并且它运行良好。 Thanks for the help 谢谢您的帮助

My issue was solved by 我的问题已经解决了

.my-class{
    *display: inline; 
    zoom: 1; 
    vertical-align: top;` 
}

It kept all elements top aligned. 它保持所有元素顶部对齐。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM