The cell Border Width problem caused by overlapping table borders. The table border

Source: Internet
Author: User

The cell Border Width problem caused by overlapping table borders. The table border

By mistake, I caught a glance at the CSS written by others. In the comments, I said that the border of the table element was folded (collapsed and overlapped. Is that word suitable ?) Different browsers calculate cell borders differently, and then write the link address Border Collapse differences in FF and Webkit in the comment, if you don't want to explore it, you can't sleep.

I opened the website angrily (every time I was angry, and often opened it slowly for various reasons) and clarified my thoughts. The general meaning was: although they handled differently, however, the last displayed interface is the same. Then I thought slowly, it seems that Firefox handled collapse according to the meaning of "collapse", and webkit handled according to the meaning of "overlap (or collapse.

In this case, it is really difficult to translate the English title. What should I do? What is the difference between FF and webkit when processing borders? Please, webkit is presented by overlap. If it is translated as "Collapsed", firefox is presented by collapse. Suddenly, a phenomenon in software patents: Protection of ideas, but protection of expressions.

The css layout of the page is as follows:

table {    table-layout: fixed;    width: 960px;    border-collapse: collapse;    border-spacing: 0;}td {    padding: 2px;    height: 22px;    border: 1px solid gray;}

Then attach the simple HTML test code:

<table>    <tbody>    <tr>        <td>I'm td1</td>        <td id="td2">            I'm td2        </td>    </tr>    </tbody></table>

Finally, use getComputedStyle (td2 ). the result calculated by borderLeftWidth is really different. The webkit is 1px and firefox is 0px, While IE can only use td2.curretStyle. borderLeftWidth. The result is consistent with that of webkit. In this case, it seems that webkit and IE are on the same route. Good friends have a leg.

It's so trivial that a chart can be understood in seconds.

--------------------------------------------

When you are bored, use the code to comfort you;

Related Article

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.