The display attribute of TR in table is abnormal in Firefox, while that in IE is normal.

Source: Internet
Author: User

Recently, when I was working on a project, I encountered a problem, that is, Ajax is required for interactive display <tr> </tr> According to common sense, when a unit of rows needs to be displayed, the display: block attribute is used. If the display is not needed, the display: None attribute is used, in addition, this is normal in IE browser, and 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 the table has multiple columns, the attribute is "  Display: Block  "  The content width of a row is only the same as the width of the first column. That is to say, no matter how many attribute values you set for colspan, the space of the remaining columns is not parsed.  2 , The same row repeatedly "  Display: none; " And "  Display: block;  "  When switching between the two States, the bottom of the table will continuously generate redundant spaces, resulting in page layout distortion. Solution:  1 Use display: Table- The row property is used 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: '   ' This dispaly property is not followed by anything. It is strange that it is compatible with Firefox and IE. The specific cause is to be analyzed by the cool.

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.