📜  Cellpadding 和 Cellspacing 的区别

📅  最后修改于: 2021-10-28 03:21:09             🧑  作者: Mango

  • 细胞填充

    Cellpadding 指定表格单元格边框与其内容之间的空间(即)它定义了单元格边缘和单元格内容之间的空白。

    句法:

    .....
    where, value determines the padding (space between the border of a table and its content)
  • 细胞间距:

    Cellspacing 指定单元格之间的空间(即)它定义了相邻单元格边缘之间的空白。

    句法:

    .....
    where, value determines the padding (space between adjacent cells)

例子:




    
    
    Document
    



  
  
  
  
  
  
    
    
  
   
    
    
  
  
    
    
  
  
    
    
  
  
NameAge
Rani30
Rajan35
Akshaya17
Ashick13

输出:

cellpadding和cellspacing的区别:

Cellpadding

Cellspacing

It specifies the space between the border of a table cell and its contents. It specifies the space between adjacent cells.
It is created by using HTML tag but type attribute is set to cellpadding.
It is also created by using HTML tag but type attribute is set to cellspacing.
It is mainly meant for a single cell. Cellspacing can get subjected to more than one cell.
The default cellpadding value is 1  Whereas, the default cellspacing value is 2
Cellpadding is widely used and considered to be an effective mean Cellspacing is less effective than Cellpadding.
Cellpadding is an attribute Cellspacing is also an attribute.