相关疑难解决方法(0)

为什么div是"display:table-cell;" 不受保证金影响?

我有div彼此相邻的元素display: table-cell;.

我想margin在它们之间设置,但margin: 5px没有效果.为什么?

我的代码:

<div style="display: table-cell; margin: 5px; background-color: red;">1</div>
<div style="display: table-cell; margin: 5px; background-color: green;">1</div>
Run Code Online (Sandbox Code Playgroud)

html css

206
推荐指数
3
解决办法
16万
查看次数

为什么div显示:table-row忽略保证金?

以下html按预期工作,除了margin-top被表行div完全忽略.我无法弄清楚原因.

<div class='table'>

  <div class='margin-top5 row user' id='user_113'>
    <div class='cell left avatar margin-right5'><img alt="Blank_avatar_thumb" src="/images/blank_avatar_thumb.png?1295354025" /></div>
    <div class='cell left'>
      <div class='bold'><a href="/voisins/113">Dandre</a></div>
      <div class='small of_hidden'>toothpicking, veryveryveryveeerrrryyyyyylooooooooong, kidnapping...</div>
    </div>
    <div class='cell right'>42</div>

    <div class='clear'></div>
  </div>
  /* more rows */
</div>
Run Code Online (Sandbox Code Playgroud)

CSS:

div.table {
  display: table;
  width: 100%;
}
div.row {
  display: table-row;
}
div.cell {
  display: table-cell;
}
div.left {
  float: left;
}
div.right {
  float: right;
}
div.clear {
  clear: both;
}
.avatar {
  vertical-align: middle;
}
.margin-top5 {
  margin-top: …
Run Code Online (Sandbox Code Playgroud)

html css

9
推荐指数
1
解决办法
1万
查看次数

如何在表格页脚/标题和正文内容之间放置一点空格?

我想在HTML表格页眉和页脚之间留出一点空间,以及我的正文内容.虽然margin-top和margin-bottom会这样做,但事实并非如此.然而字体重量:粗体; 指令被考虑在内.

我的HTML:

<table id="myTbl">
   <thead>
     <tr>
       <th>My Table Header</th>
     </tr>
   </thead>  
   <tbody>
    <tr>
      <td>My Body Content</td>
    </tr>
    </tbody>
   <tfoot>
     <tr>
       <th>My Table Footer</th>
     </tr>
   </tfoot>  
</table>
Run Code Online (Sandbox Code Playgroud)

我的CSS:

#myTbl {
    font-weight: normal;
}

#myTbl thead {
    font-weight: bold;
    margin-bottom: 10px;
}

#myTbl tfoot {
    font-weight: bold;
    margin-top: 10px;
}
Run Code Online (Sandbox Code Playgroud)

JSFiddle可以在这里找到.我正在使用Chrome.

html css html-table footer

7
推荐指数
4
解决办法
2万
查看次数

如何在设置为显示表格单元格的div之间添加边距?

我设置一个父div显示:table及其显示的三个子div:inline-cell.这三个子div是水平堆叠的,我在三个子div上设置了三个像素的边框.我如何在子div之间添加边距,以便将空间放在边框外部而不是内部?

html css

2
推荐指数
1
解决办法
2323
查看次数

为什么图像不适合表格单元格

在此输入图像描述

我想知道为什么图像不拉伸整个表格单元格?

这是代码:

<td width="110" height="100" style="margin: 0; padding: 0; border: 1px solid rgb(0, 174, 239); background-color: #00FF00">
    <a target="_blank" href="http://mymed.com/provider.aspx?id=2611" xt="SPCLICKSTREAM" name="Kamin_1"><img style="width: 100%; height: 100%; display: inline-block;" alt="s, kam, MD" border=0 src="http://mymed.com/images/email/Physicians/Kaminski.jpg" name="Cont_19" /></a>
</td>
Run Code Online (Sandbox Code Playgroud)

html css

2
推荐指数
1
解决办法
3240
查看次数

display:table-cell margin

我有2个div display: table-cell.我需要他们之间的空间.

margin-left: 5px 对于第二个div不起作用.

我已经看到为什么一个div有"display:table-cell;" 不受保证金影响?回答,但我的问题不是关于如何在一个单元格周围设置边框,而是一个左边缘(而不是填充!)用于具体单元格(右边的)

在此输入图像描述

将绿色div设置为

display: table;
border-collapse: separate;
border-spacing: 10px;
Run Code Online (Sandbox Code Playgroud)

不仅细胞之间,而且在细胞周围都有空间,这就是NOK ...

如何进行?

JSFiddle:http://jsfiddle.net/9cw7rhpu/

html css

1
推荐指数
1
解决办法
9746
查看次数

标签 统计

css ×6

html ×6

footer ×1

html-table ×1