如何在HTML5上使用cellpadding和cellspacing?

[英]How to use cellpadding and cellspacing on HTML5?


Am trying to use CSS3 to set the cell-spacing and the cell-padding for my table since HTML5 doesn't support these attributes.

我試圖使用CSS3為我的表設置單元格間距和單元格填充,因為HTML5不支持這些屬性。

I have found many resources on the internet says that you should use border-spacing and padding using CSS.

我發現互聯網上有很多資源說你應該使用CSS來使用邊框間距和填充。

Unfo. i tried all these tricks , but it seems that no thing changing at all. The spacing is very important because am including image structure on the different cell of the table.

UNFO。我嘗試了所有這些技巧,但似乎沒有任何改變。間距非常重要,因為我在表格的不同單元格中包含圖像結構。

So how i can solve it now ? plz need your help

那我現在怎么解決呢? PLZ需要你的幫助

#SearchTable
{
    border-collapse: collapse;
    padding:0px 0px 0px 0px;
}

#SearchTable td 
{
    padding:0;
    border-spacing:0px 0px; 
}

3 个解决方案

#1


21  

For cellspacing:

  1. Set border-spacing on the table, not on the td.
  2. 在表格上設置邊框間距,而不是在td上。

  3. Set border-collapse to separate.
  4. 將border-collapse設置為單獨。

#SearchTable {
   border-collapse: separate;
   border-spacing: 8px; 
}

#2


4  

You have not set id=SearchTable on the table, or you have some other stylesheet rules that override those that you specify. As such, the rules you posted are more than sufficient for the effect; you only need

您沒有在表上設置id = SearchTable,或者您有一些其他樣式表規則覆蓋您指定的規則。因此,您發布的規則綽綽有余;你只需要

#SearchTable
{
    border-collapse: collapse;
}

#SearchTable td 
{
    padding:0;
}

(which are already in CSS2).

(已經在CSS2中)。

#3


0  

You need to set it like this. It worked for me.

你需要像這樣設置它。它對我有用。

#SearchTable {
    border-spacing:2px 2px;
    border-collapse:separate;
}

#SearchTable td {
    border:1px solid black;
}

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2012/01/21/7237110cf671697197fef03e09db5bbb.html



HTML5中沒有cellspacing和cellpadding怎么辦 HTML cellpadding與cellspacing屬性 html5中不再支持table的cellspacing和cellpadding屬性 In HTML5, with respect to tables, what replaces cellpadding, cellspacing, valign, and align? html5中不再支持table的cellspacing和cellpadding屬性 Is it ok to use cellpadding=“2” cellspacing=“2” in ?在html5中不支持
的cellpadding 和 cellspacing ; 2) 如何用css實現 cellpadding, cellspacing ; 3) tr , th 是 有 border, 沒有 padding 的.How to set cellpadding and cellspacing in table with CSS? [duplicate]How to solve this warning Type Attribute (cellpadding) is obsolete. Its use is discouraged in HTML5 documentscellspacing的作用 cellspacing和cellpadding區別
 
  © 2014-2022 ITdaan.com 联系我们: