Table cellspacing and CellPadding properties are no longer supported in HTML5

Source: Internet
Author: User

If you start writing a page with HTML5 's declaration now, you'll notice that the property is outdated or prompt for illegal properties when defining the cellspacing and cellpadding of the table. This is due to the fact that the two properties of the table tag have been removed in HTML5, and the CSS should be used when defining the border.

The specific implementation is as follows:

<!DOCTYPE HTML><HTMLxmlns= "http://www.w3.org/1999/xhtml"><Head>    <title>HTML5 Table Test</title>    <styletype= "Text/css">Table{Border-collapse:collapse;Border:Solid 1px Black; }Table TD{width:50px;Height:20px;Border:Solid 1px Black;padding:5px;}    </style></Head><Body>    <Table>        <TR>            <TD></TD>            <TD></TD>        </TR>        <TR>            <TD></TD>            <TD></TD>        </TR>    </Table></Body></HTML>

As follows:

The key point of the code is border-collapse:collapse; and Border:solid 1px Black;. For the definition of padding everyone is more familiar with, here is the main talk about the border-collapse in the collapse and separate values, defined as collapse, their borders will overlap together, When defined as separate, there is a gap between the cell borders. Defaults to separate when not defined. The separate case is as follows:

Code definition is very simple, is also the early version of the browser support things, but some of us used to use cellspacing and cellpadding to define, but these two properties will be removed in HTML5, so need to change to use CSS to define it. It's a simple thing, just a little bit of a note.

Note: In HTML5, many of the tag element's attributes are no longer present. The following are the core attributes and language attributes (with individual exceptions) that are common to each label in HTML5.

Class, Contenteditable, ContextMenu, dir, draggable, id, irrelevant, lang, ref, Registrationmark, TabIndex, template, titl E

Reprinted from: Http://xxling.com/article/76.aspx

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.