HTML introduction and Examples

Source: Internet
Author: User
Tags html comment

HTML introduction and Examples

Hyper Text Markup Language (HTML)It is a markup language designed for "webpage creation and other information that can be seen in a web browser. HTML is used to describe the appearance and semantics of a document to a certain extent. It is the key to the WEB technology world.

1. Introduction to HTML:HTML is a language used to describe web pages. It is not a programming language, but a markup language.(Markup language), a markup language is a set of markup tags, which use tags to describe web pages.

HTML tag is usually called HTML tag );HTML tags are keywords surrounded by Angle brackets.For exampleHTML tags are usually paired, suchAnd <\ B>; the first tag in the tag pair is the start tag, and the second is the end tag. the start and end tags are also known as open and closed tags.

HTML documents describe webpages. HTML documents include HTML tags and plain texts. HTML documents are also called webpages.

Web browsers read HTML documents and display them as webpages. The browser does not display HTML tags, but uses tags to explain the content of the page.

2. HTML basics: HTML Heading is defined by-and other tags.

The HTML section is

Label.

HTML links are defined by tags. Specify the link address in the href attribute.

HTML images are defined by tags. The image name and size are provided in the form of attributes.

3. HTML elements: HTML documents are defined by HTML elements.

An HTML element refers to all the code from the start tag to the end tag. The start tag is often called the opening tag, and the end tag is often called the closed tag ).

HTML element Syntax: (1) starting with the HTML element; (2) ending with the HTML element; (3) the content of the element is the content between the start tag and the end tag; (4) Some HTML elements have empty content (empty content); (5) empty elements are closed in the start tag (end with the end of the start tag); (6) Most HTML elements can have attributes.

Nested HTML elements: Most HTML elements can be nested (Other HTML elements can be included ).

An HTML document consists of Nested HTML elements..

The element defines the subject of an HTML document.

The element defines the entire HTML document.

Do not forget the end tagEven if you forget to use the end tag, most browsers correctly display HTML. Unexpected results or errors may occur if you forget to use the end tag. End tags cannot be omitted in future HTML versions.

Empty HTML elements: HTML elements without content are called empty elements. Empty elements are disabled in the start tag.
Is the empty element that does not close the tag (
Label definition line feed ). In XHTML, XML, and HTML of future versions, all elements must be disabled. Add a slash to the start tag, for example
Is the correct way to disable empty elements. HTML, XHTML, and XML both accept this method. Even if
Valid in all browsers,
It is actually a long-term guarantee.

HTML tags are case insensitive.,

Equivalent

Many websites use uppercase HTML tags. In future (X) HTML versions, lowercase is mandatory.

4. HTML attributes: Attributes provide attachment information for HTML elements.

HTML tags can have attributes. Attribute provides more information about HTML elements.Attribute always appears in the form of name/valueFor example, name = "value ". Attributes are always specified in the starting tag of the HTML element.

Attributes and attribute values are not case sensitive. The new version (X) HTML requires lower-case attributes.

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. In some cases, for example, if the attribute value itself contains double quotation marks, you must use single quotation marks.

5. HTML title: The title (Heading) is defined by a-label. Define the largest title and the smallest title.

The browser automatically adds blank lines before and after the title. By default, HTML automatically adds an extra blank line before and after block-level elements, such as paragraphs and titles. Make sure that the HTML heading label is used only for the title. You do not need to use titles only to generate bold or large text. Search engines use titles to index the structure and content of your web page.

Create a horizontal line for the tag on the HTML page. The hr element can be used to split the content. Using a horizontal line (TAG) to separate sections in an article is one way (but not the only way ).

HTML comment: You can insert comments into HTML code to improve readability and make the code more understandable. The browser ignores and does not display comments. The comment is written as follows: , Followed by an exclamation point.

View Source Code: You only need to right-click and select "View Source File" (IE) or "view page source code" (Firefox). The same applies to other browsers. In this case, a window containing HTML code is opened.

6. HTML paragraphs: HTML documents can be divided into several paragraphs. The section is passed

Label defined. The browser automatically adds blank lines before and after the paragraph (

Is a block-level element ). Use an empty section tag

Inserting a blank row is a bad habit. Use
Label to replace it. But do not use
Tag to create a list.

Use
Label.
An element is an empty HTML element. Because closing a tag does not make any sense, it does not end the tag. HTML elements without ending tags (closed tags) are not allowed in XHTML, XML, and future HTML versions. Even if
The display in all browsers is correct.
It is also a long-term guarantee.

Use
Label.
An element is an empty HTML element. Because closing a tag does not make any sense, it does not end the tag. HTML elements without ending tags (closed tags) are not allowed in XHTML, XML, and future HTML versions. Even if
The display in all browsers is correct.
It is also a long-term guarantee.

For HTML,You cannot add extra spaces or line breaks to HTML code to change the output effect.. When the page is displayed, the browser removes unnecessary spaces and blank lines from the source code. All consecutive spaces or empty rows are counted as one space. Note that all consecutive blank lines (line breaks) in HTML code are displayed as a space.

7. HTML Text Formatting: HTML can define many elements for formatting output, such as bold and italic.

8. HTML editor: use Notepad or TextEdit to compile HTML.

When saving HTML files, you can either use .htmor use the. html extension. There is no difference between the two types based on your preferences.

9. HTML style (CSS): When the browser reads a style sheet, it will format the document according to the style sheet. There are three ways to insert a style sheet: (1) external style sheet: When a style needs to be applied to many pages, external style sheets are ideal. With the external style sheet, you can change the appearance of the entire site by changing a file. (2) Internal style sheet: an internal style sheet can be used when a single file requires a special style. You can use

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.