HTML5 Study Notes: Three HTML elements, attributes, titles, paragraphs, and html5 Study Notes

Source: Internet
Author: User
Tags html comment

HTML5 Study Notes: Three HTML elements, attributes, titles, paragraphs, and html5 Study Notes
I. HTML elements

  • The HTML element usesStart tagStart
  • The HTML element usesEnd tagTermination
  • Element ContentIs the content between the start tag and the end tag.
  • Some HTML elements haveEmpty content)
  • Empty ElementClose in start tag(End with the end of the start tag)
  • Most HTML elements can haveAttribute
Nested HTML elements

An HTML document consists of Nested HTML elements.

<! Doctype html> <body> <p> This is the first paragraph </p> </body> Do not forget the end tag

Even if you forget to use the end tag, most browsers correctly display HTML.

Empty HTML Element

HTML elements without content are called empty elements. Empty elements are disabled in the start tag.

<Br> is an empty element that does not close the tag (<br> label definition line feed ).

In XHTML, XML, and HTML of future versions, all elements must be disabled.

Adding a slash to the start tag, such as <br/>, is the correct method to disable empty elements. HTML, XHTML, and XML both accept this method.

Even if <br> is valid in all browsers, using <br/> is actually a long-term guarantee.

HTML prompt: use lower-case tags

HTML tags are not case sensitive: <P> equivalent to <p>. Many websites use uppercase HTML tags.

W3CSchool uses lower-case tags because the W3C is in HTML 4.RecommendationUse lower-case letters, and in future (X) HTML versionsForceUse lower-case letters.

 

Ii. HTML attributes
  • HTML elements can be setAttribute
  • Attribute can be added to an element.Additional information
  • Attribute is generally described inStart tag
  • Attributes always appear in the form of name/value pairs,For example: name = "value".
Common HTML Property Reference property values

Attribute values should always be enclosed in quotation marks.

Double quotation marks are the most commonly used, but it is no problem to use single quotation marks.

Tip:In some cases, for example, if the attribute value itself contains double quotation marks, you must use single quotation marks. For example, name = 'John "AB" Nelson'

HTML prompt: use lower-case attributes

Attributes and attribute values are not case sensitive.

However, the World Wide Web Alliance recommends lower-case attributes/attribute values in its HTML 4 Recommendation Standard.

The new version (X) HTML requires lower-case attributes.

Applicable to attributes of most HTML elements:

Iii. HTML title

Heading is defined using the

<H1> define the largest title. <H6> define the smallest title.

H1 should be used as the title (the most important), followed by h2 (the second important), followed by h3, and so on.

HTML horizontal line

<Hr> Create a horizontal line for the tag on the HTML page.

The hr element can be used to separate content.

HTML comment

You can insert comments into HTML code to improve readability and make the code easier to understand. The browser ignores and does not display comments.

Note:An exclamation mark must be followed after the parentheses begin (the left parenthesis), but not before the parentheses end (the right Parenthesis.

Common labels:

The sum code above is as follows:

<! Doctype html> <H1> title 

:

Iv. HTML Section

The section is defined by the <p> label.

HTML line breaks

If you want to wrap a line (New Line) without generating a new paragraph, use the <br/> label:

Example:

<! Doctype html> <body> 

:

The labels used above:

 

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.