【问题标题】:Table cell width alignments表格单元格宽度对齐
【发布时间】:2019-01-26 02:30:37
【问题描述】:

我有一个 table 设置为 width=100%,有 2 列。
如何使第一个table data 占用菜单控件的size(在td1 内),然后使td2 占用剩余空间的size
如果我将td2's 宽度设置为100%,我的菜单collapses/wraps-up

下面是我的代码:

<table border="1" width="100%">
    <tr>
    <td>
    <asp:Menu ID="Menu" runat="server" Orientation="Horizontal">
    <Items>
    <asp:MenuItem Text="Home" Value="Home"></asp:MenuItem>
    <asp:MenuItem Text="ContactUs" Value="ContactUs"></asp:MenuItem>
    <asp:MenuItem Text="About Us" Value="About Us"></asp:MenuItem>
    </Items>
    </asp:Menu>
    </td>
    <td>TD2</td>
    </tr>
</table> 

【问题讨论】:

  • 您是否通过搜索 HTML Table cell width alignments 来查看早期的答案。有 36 次点击。

标签: html html-table


【解决方案1】:

尝试以下方法:

<div class="row">
  <div class="col-md-4"> Your menu here</div>
  <div class="col-md-8">Content here </div>
</div>

您将需要引导程序。

【讨论】:

  • 嗨 Nduna,谢谢,但是当我尝试这个时,它所做的只是将 2 个 div 放在彼此下方,而不是彼此相邻