簡體   English   中英

表格行的左右邊距

[英]Left and right margin on a table row

如何設置表格行的左右邊距(或類似的東西以達到相同的結果)? 我試過border-collapse:separate; border-spacing:20px; border-collapse:separate; border-spacing:20px; 但這刪除了行邊框底部。

這就是我想要創建的:

http://i54.tinypic.com/eqce83.jpg

將 class 添加到表中,然后在左右添加填充。

表類="一些表"

.some-table { padding-left:10px; 填充右:10px; }

應該管用。

如果沒有,則在左側添加一個 class 並將填充附加到左右列。

我不認為這對表格是可能的。

這里是 div 和 span。 我希望你喜歡它:

<html>
 <head>
  <style>
   div#outer {
    border: 10px solid black;
    width: 30em;
   }
   div#header {
    background-color: red;
    color: white;
    text-align: center;
   }
   div.row {
    border-bottom: 1px dashed red;
    margin: 10px 20px;
    clear: both;
   }
   span.left {
    float: left;
   }
   span.right {
    margin-left: 10em;
   }
  </style>
</head>
 <body>
  <div id="outer">
  <div id="header">Some table head text</div>
   <div class="row">
    <span class="left">Col</span>
    <span class="right">Col</span>
   </div>
   <div class="row">
    <span class="left">Col</span>
    <span class="right">Col</span>
   </div>
   <div class="row">
    <span class="left">Col</span>
    <span class="right">Col</span>
   </div>
  </div>
 </body>
</html>

暫無
暫無

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

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