Display the border when the TD content in the table is empty

Source: Internet
Author: User

Original article: how to display the border when the TD content in the table is empty



  1. Definition and usage
  2. Instance
  3. Browser support
  4. Possible Value
  5. Definition and usage
    1. Description
  6. Instance
  7. Browser support
  8. Possible Value
  9. Related Pages














1. Add:Border-collapse: collapse;
Add:Empty-cells: show;

2. The simplest thing is to write an & nbsp; In TD;





Border-collapseSet or retrieve whether the row and cell edge of the table are merged or separated according to the standard HTML style.


Definition and usage

The border-collapse attribute sets whether the border of the table is merged into a single border or displayed separately as in standard HTML.

Default Value: Separate
Object. style. bordercollapse = "collapse"



Set the merge border model for the table:

border-collapse:collapse;  }


Browser support

All mainstream browsers support the border-collapse attribute.

Note: any version of Internet Explorer (including IE8) does not support the attribute value "inherit ".

NOTE: If not specified! Doctype, then border-collapse may produce unexpected results.


Possible Value
Default value. Borders are separated. The border-spacing and empty-cells attributes are not ignored.
If possible, the border is merged into a single border. The border-spacing and empty-cells attributes are ignored.
Specify that the value of the border-collapse attribute should be inherited from the parent element.







Definition and usage

The empty-cells attribute sets whether to display empty cells in the table (only used in "split border" mode ).

Note: Some versions of IE browsers do not support this attribute.


This attribute defines how table cells that do not contain any content are represented. If it is displayed, the border and background of the cell are drawn. This attribute is ignored unless border-collapse is set to separate.

Default Value: Show
Object. style. emptycells = "hide"



Hide the border and background of the empty cells in the table:

table  {  border-collapse:separate;  empty-cells:hide;  }


Browser support

All browsers support the empty-cells attribute.

NOTE: If specified! Doctype, Internet Explorer 8 (and later) supports the empty-cells attribute.


Possible Value


Borders are not drawn around empty cells.
Draw borders around empty cells. Default value.
Specifies that the value of the empty-cells attribute should be inherited from the parent element.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.