Display: Block Layout disorder of TR in table

Source: Internet
Author: User

From: http://blog.sina.com.cn/s/blog_5b6c4f550100yk4x.html

Recently, when I was working on a project, I encountered a problem, that is, Ajax was needed to display the content in the <tr> </tr> tag interactively. According to common sense, when a line needs to be displayed, use the: Display: block attribute. The display: None attribute is used when no display is required, and the display is normal in IE browser, so there is no problem.

However, when using Firefox for browsing, there was a layout disorder. Then, through firebug, I went to view the source code, debugged it, and found that it was a ghost of the display: block attribute.

1. When a table contains multiple columns, the content width of the row whose attribute is "display: Block" is only the same as that of the first column, that is, no matter how many attribute values you set for colspan, the space of the remaining columns is not parsed.
2. The same row is repeatedly switched between "display: none;" and "display: block, at the bottom of the table, excessive spaces are generated continuously, resulting in page layout distortion.

1. Use the display: Table-row attribute for debugging. The discoverer is normal in Firefox, but IE does not support Attribute Modification. What should I do? Use Js for judgment, and then make compatibility.
2. Another simple and feasible method is to use the display: ''attribute dispaly without adding anything. It is strange that it is compatible with Firefox and IE. The specific cause is to be analyzed by the cool.

PS: Each HTML tag has its own default display attribute. When you set display to null, the browser should set the element to the default attribute, therefore, it is compatible with all browsers, which is no choice but a choice!

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.