簡體   English   中英

CSS表格布局

[英]css Table-layout

為什么表格中的內容似乎從中心開始,如何使其從行的開頭開始

 <table style="table-layout:fixed;width:100%;" border="1"  cellpadding="0" cellspacing="0" class="main_table" id="main_table">

   <tr>
                    <td width="20%" height="70px" align="center" id="plugins" class="step step1 clickable" step="1" onclick="javascript:getresource('1','0');">
                       <font color="blue">Plugins</font>
                    </td>
                       <td rowspan="5" width="80%" height="100%" align="center" ><br>
                          <div id="status" class="msg" style="display:none"><br></div>
                          <div id="header_msg" height="100%" align="center"></div>
                          <div id="contents" height="100%"></div>
                          </td>
                  </tr>

 </table>

從td和第二個div中刪除“ align =“ center””,如果希望數據從單元格的頂部開始,請在tr中添加“ valign =“ top””,即:

    <table style="table-layout:fixed;width:100%;" border="1"  cellpadding="0" cellspacing="0" class="main_table" id="main_table">

   <tr valign="top">
                    <td width="20%" height="70px" id="plugins" class="step step1 clickable" step="1" onclick="javascript:getresource('1','0');">
                       <font color="blue">Plugins</font>
                    </td>
                       <td rowspan="5" width="80%" height="100%"><br>
                          <div id="status" class="msg" style="display:none"><br></div>
                          <div id="header_msg" height="100%"></div>
                          <div id="contents" height="100%"></div>
                          </td>
                  </tr>

 </table>

除了過分使用內聯CSS,用於布局的HTML表和不那么受歡迎的-tag外,我猜是這樣。

align="center"

..使您的內容居中。 嘗試將其替換為“ left”。 不過請考慮使用CSS方式:

text-align: left;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM