"HTML5 and CSS3 authoritative guide" reading notes

Source: Internet
Author: User
Tags closing tag

"HTML5 and CSS3 authoritative guide" Mechanical Industry Press

The difference between Chapter 2-HTML5 and HTML4

1.DOCTYPE Declaration

HTML4: <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3c.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd ">

HTML5: <! DOCTYPE html>

The above code we call the DOCTYPE statement. DOCTYPE is a shorthand for document type, which is used to describe what version of XHTML or HTML you are using.

The DTD (for example, XHTML1-TRANSITIONAL.DTD in the previous example ) is called the document type definition, which contains the rules of the document, and the browser interprets the identity of your page according to the DTD you define and shows it.

The DOCTYPE statement is an essential part of establishing a standard-compliant web page, and your logo and CSS will not take effect unless your XHTML determines the correct DOCTYPE.

2. Specify character encoding

HTML4: <meta http-equiv= "Content-type" content= "Text/html;charset=utf-8" >

HTML5: <meta charset= "UTF-8" >

Rules for element tagging in 3.HTML5

The elements that are not allowed to write end tags are: area, base, BR, col, command, embed, HR, IMG, input, keygen, link, meta, param, source, track, WBR; (Example: )

The elements that can omit the closing tag are: Li, DT, DD, p, RT, RP, optgroup, option, Colgroup, THEAD, Tbody, TFOOT, TR, TD, Th; (Example:<li>)

The elements that can omit all tags are: HTML, head, body, Colgroup, tbody; (example: an element exists implicitly, the head tag is also present in the document)

4. Properties that have a Boolean value

HTML4: <input type= ' checkbox ' checked= ' checked ' >

HTML5: <input type= ' checkbox ' checked>

Similar to the following: readonly, disabled

5. Attributes omit quotation marks

Html4:<input type= ' text ' >

Html5:<input type=text>

Note: You can omit a property when it does not include an empty string, <, >, =, ', '

  

"HTML5 and CSS3 authoritative guide" reading notes

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.