【问题标题】:Table and column html表和列html
【发布时间】:2013-09-19 22:52:07
【问题描述】:

我正在使用具有非常好的网格效果的主题。 td 的正常数量是 5。但是对于某些部分我只需要两个,而对于其他部分我需要更多。我希望它们都具有相同的尺寸,因为当我放入所需的适当数量时,有时会将盒子拉伸得太大或太小。这是 CSS,如果您需要其他任何内容,请告诉我。

body {background-color:#cccccc; color:#000000; font:16px Arial, sans-serif; word-wrap:break-word; width:100%; height:100%; margin:0; padding:0;}
a {text-decoration:underline; color:black;}
a:hover {text-decoration:none;}
#wrappper {background-color:#ffffff; width:600px; margin:60px auto; padding:0 50px 50px;}
#title {background-color:#000000; color:#ffffff; text-align:center; text-transform:uppercase; padding:20px 0; margin:0 -50px 20px;}
table {width:100%; border-collapse:collapse;}
table th {font-size:20px; padding:24px 0 8px; text-transform:uppercase; text-align:left;}
table td {vertical-align:center; padding:4px 1px;}
table table {width:300px; height:50px;}
table table td {border:solid 1px #000000; width:50px; height:50px; padding:0;}
table table td img {display:block; border:0; max-width:30px; max-height:30px; width:auto; height:auto; margin:auto;}
#credit {border-top:solid 2px black; margin-top:40px; padding-top:20px; text-align:center; font-size:12px;}

然后是我相信的 colspan...

<table>
<col width="auto"><col width="150px"><col width="150px">

<tr><th colspan="2">

jsFiddle:http://jsfiddle.net/Zorabelle/sYJKt/

【问题讨论】:

  • 你在用colspan吗?
  • 是的,这是我的表格代码的开头:

标签: html css html-helper tumblr html-table


【解决方案1】:

在给定的&lt;tr&gt; 中少于 5 个的地方添加空的 &lt;td&gt;&lt;/td&gt;s。或者,如果您想“加入”&lt;td&gt;s,请使用 colspan

编辑:如何使用隐藏的&lt;td&gt;s 来维护布局,就像在this jsFiddle 中一样:

td.hidden {
    visibility: hidden;
}

【讨论】:

  • 那我不确定是什么问题。你能整理一个 [jsFiddle](www.jsfiddle.com) 来演示这个问题吗?
  • 好的,但它按预期工作,不是吗?你不喜欢怎么办?
  • 我希望所有的盒子都一样大。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-08-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-08-04
相关资源
最近更新 更多