2011-07-26 15 views
3

我的問題: 如何在沒有文字的情況下離開表格TD,而不會使其消失。如何能夠顯示沒有文字的表格TD's

我用這個HTML代碼:

<div id="push_down"></div> 

    <div id="global_wrapper"> 
     <table cellpadding="0" cellspacing="0" border="0" id="sep_table"> 
      <tr> 
       <td id="side_1"></td> 
       <td id="main"></td> 
       <td id="side_2"></td> 
      </tr> 
     </table> 
    </div> 

而這個CSS代碼:

html, body { 
margin: 0px; 
padding: 0px; 
} 

#push_down { 
    padding-top: 53px; 
} 
#global_wrapper { 
} 
#sep_table { 
    margin: 0px auto; 
    width: 100%; 
} 
#side_1 { 
    background:url(../images/navbar-bg-left.jpg) center repeat-x; 
    height:78px; 
} 
#main { 
    background:url(../images/navbar.jpg) center no-repeat; 
    height:33px; 
    width: 989px; 
    padding-top:45px; 
} 
#side_2 { 
    background:url(../images/navbar-bg-right.jpg) center repeat-x; 
    height:78px; 
} 
.navbar{ 
    font-size:14px; 
    font-weight:bold; 
    color:#FFF; 
} 
.navbar a:link{ 
    color:#FFF; 
    text-decoration:none; 
} 
.navbar a:visited{ 
    color:#FFF; 
    text-decoration:none; 
} 
.navbar a:hover{ 
    color:#131313; 
    text-decoration:none; 
} 
.navbar a:active{ 
    color:#FFF; 
    text-decoration:none; 
} 

回答

7

用CSS:

table { 
empty-cells:show; 
} 

在HTML中(不是真的乾淨):

<table> 
<tr> 
<td>&nbsp;</td> 
</tr> 
</table> 
+0

它適用於IE和FF,但不適用於谷歌瀏覽器 –

+0

如果在單元中有 ,那麼它應該在任何地方工作。 –

+0

@Ieecube - 嘗試添加Ixecube'border-collapse:collapse'來修復鑲邊。 – easwee

0

您可以添加這種風格:

td{ 
    width: 20px; 
    height: 20px; 
    display: block; 
} 
+0

這將使所有tds固定高度 - 他可能不希望這樣。 – easwee

1

你也可以把透明圖像(如PNG圖片)與1px height1px width

Photoshop在使用space.png作爲桌面容器上的輔助圖像時,可以保存爲網頁和設備,您可以複製此想法。

還記得把這個相同的圖像height and width 100%,填補所有的表格單元格。