Show border when no content in TD

Source: Internet
Author: User

TD in the absence of content, the default is not to display the TD border, at this time the page is a blank, the user does not know there is actually a, and the page is messy, collected the next, summed up the following several solutions:

1. Add a space in the cell . Such<td>&nbsp;</td>

2, directly in the table this write: <table width="300" border="1" style="border-collapse:collapse;"> **border-collapse can only be collapse, although Border-collapse also has separate,inherit attributes. This way you can display the border, but it's depressing-it shows a thin border. Incidentally, separate and collapse.

Separate:separate: Default value. The border is independent (standard HTML), as shown when this property is not used. (Inherit in my opinion with separate no difference, maybe I cruel, hehe)
Collapse: Adjacent edges are merged

Adjacent edges are merged! By default, adjacent edges are not merged, so this is 1+1=2. Now we're using border-collapse:collapse to merge us, so the width is 1+1=1 and the hairline border appears.

3, table { caption-side: top; width: auto; border-collapse: collapse; empty-cells: hide; } or
table {width:100%;border-collapse: separate;empty-cells:show;}

However, currently IE6.0 holds this attribute and appears to be only used in CSS2. The corresponding script attribute is emptycells.

4, <table cellspacing=2 border=1 rules="cols"> here can make the frame display the core is rules= "cols"

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Show border when no content in TD

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.