我有一个<div>
内的表:从百分比转换宽度像素
<div id="fixeddiv">
<table id="fixedtable">
<tr class="firstrow">
<td class="td11"></td>
<td class="td12"></td>
<td class="td13"></td>
</tr>
<tr class="secondrow">
<td class="td21" style="width:10%"></td>
<td class="td22" style="width:20%"></td>
<td class="td23" style="width:70%"></td>
</tr>
</table>
</div>
CSS:
#fixeddiv
{
overflow:auto;
margin:0px;
padding:0px;
position: relative;
text-align:left;
width: 48%;
}
#fixedtable
{
background-color: White;
border-spacing:0px;
cursor: pointer;
width: 100%;
height: 100%;
font-family: Calibri !important;
color: Black;
font-size: 14px;
}
.firstrow
{
position: absolute;
margin: 0px;
left: 0;
top: 0;
background: url(../Content/Images/header.jpg) repeat-x center top;
color: White;
font-weight: bold;
text-align: center;
}
#fixedtable tr td
{
padding: 5px !important;
border: 1px solid #FFFFFF;
text-align: center;
}
我计算的td21
宽度与$('.td21').width()
和分配宽度td11
如$('td11').width($('.td21').width())
。
问题是,应用的宽度不一样,它们变化了1px
,我无法找到这种差异如何发生。 .td21
宽度为1px
大于.td11
。
任何人都可以帮我找到解决方案吗?
它是1 px总是更大?为什么不只是-1的值) – Feanor 2012-07-06 08:09:47