2010-04-14 109 views
1

我的网页目前看起来是这样的:收缩单元格(在绝对位置的ASP.NET表格中)以适合其内容?

<asp:Table runat="server" style="position: absolute; 
    left: 0%; top: 82%; right: 0%; bottom: 0%; width: 100%; height: 18%" 
    CellPadding="0" CellSpacing="0" GridLines="Both"> 
    <asp:TableRow> 
     <asp:TableCell> 
      Content1 
     </asp:TableCell> 

     <asp:TableCell Width="2.5%"> 
     </asp:TableCell> 

     <asp:TableCell > 
      Content2 
     </asp:TableCell> 
    </asp:TableRow> 
</asp:Table> 

http://img684.imageshack.us/img684/9677/tableu.png

但我需要它看起来像这样:
http://img263.imageshack.us/img263/4508/table2k.png
“内容1” 是未知大小的,和表将不得不调整以适应它,但不会从“Content2”中分离出任何不必要的空间。我不能使用“display:table”,因为它在IE7等不支持,所以我几乎坚持使用常规的表格元素,除非在旧版浏览器中支持更好的东西。

有谁知道这是如何实现的?

回答

1

为什么不向Content2单元添加宽度?例如:

<asp:Table runat="server" style="position: absolute; 
    left: 0%; top: 82%; right: 0%; bottom: 0%; width: 100%; height: 18%" 
    CellPadding="0" CellSpacing="0" GridLines="Both"> 
    <asp:TableRow> 
     <asp:TableCell> 
      Content1 
     </asp:TableCell> 

     <asp:TableCell Width="2.5%"> 
     </asp:TableCell> 

     <asp:TableCell Width="97.5%"> 
      Content2 
     </asp:TableCell> 
    </asp:TableRow> 
</asp:Table> 
相关问题