HTML Series (i): Creating HTML documents

Source: Internet
Author: User

From this semester onwards I intend to summarize the knowledge I have learned in the past, starting with HTML.

One, HTML document type

The HTML version is numerous, how does the browser know which version to use? At the beginning of the document, there is a DOCTYPE declaration, which is used to identify the HTML version, consisting of a separate label. <! The doctype> declaration refers to a DTD (document type definition), which specifies the rules for the markup language. There are several types of doctype in the HTML4 and XHTML 1.0 era, each of which indicates whether the HTML used is strict or transitional.

//Strict mode <! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01//en" "HTTP://WWW.W3.ORG/TR/HTML4/STRICT.DTD" > //Transition mode <! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd " >

And HTML5 is much simpler, all browsers are common, do not worry about compatibility issues, just write:

<! DOCTYPE HTML >

Meta element defines page meta information

<!DOCTYPE HTML><HTMLLang= "en">//defining Chinese Web pages
<Head> <MetaCharSet= "UTF-8">//Document character encoding, if not declared, may be garbled <title>Document</title></Head><Body> </Body></HTML>

The Lang property needs to be specified only in H5. This property defines the type of language in which the document was created, and zh is the Chinese meaning.

The properties of the <meta> tag define the name/value pairs associated with the document.

Name Property

The Name property provides the names in the name/value pairs. "keywords" is a name that is often used. It defines a set of keywords for a document. Some search engines use these keywords to categorize documents when they encounter these keywords. A meta tag like this might be helpful for entering the index of a search engine:

name="keywords"Content= "Html,asp,php,sql" >

If the Name property is not provided, then the names in the name/value pairs take the value of the Http-equiv property.

Http-equiv Property

The Http-equiv property provides a name for a name/value pair. and instructs the server to include a name/value pair in the header of the MIME document to be routed to the browser before sending the actual document.

When the server sends a document to the browser, many name/value pairs are sent first. Although some servers send many of these name/value pairs, all servers must send at least one: content-type:text/html. This tells the browser to be ready to accept an HTML document.

When using the <meta> tag with the Http-equiv property, the server adds a name/value pair to the header of the content sent to the browser. For example, add:

http-equiv="charset"http-equiv="expires"Content= "from Dec" >

The head that is sent to the browser should contain:

Content-type:text/htmlcharset:iso-8859-1expires:31 DEC 2008

Of course, these fields make sense only if the browser can accept these additional header fields and use them in the appropriate way.

Content Properties

The Content property provides the value in a name/value pair. The value can be any valid string.

The content property is always used with the Name property or the Http-equiv property.

C. base element definition Base URL

The base tag is defined within the head tag, and the HTML document transforms all the relative URLs in the current HTML document into absolute URLs through the base URL. When a browser browses a webpage, the relative URL is appended to the base URL by <base>, which is the absolute URL.

Base can also tell the browser how to open the page by using the target property.

Iv. Title Property

The Title property is used to add descriptive text to an image, link, or button, and the hover hint text appears when the mouse moves over the target element. Can be used in all tags except base, Basefont, head, HTML, meta, param, script, title.

HTML Series (i): Creating HTML documents

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.