Introduction HTML Notes (a) the basis of the label

A basic html file must contain the <html>, <head> and <body> tag and three <! Doctype> declaration

1.  <! DOCTYPE> tag

Declaration must be the first line of HTML documents located in <html> tag before.

Declaration is not an HTML tag; it is an indication about which web browser HTML version of the page using the instructions written.

In Html5 only one declaration form <! DOCTYPE html>

 

2. <html> tag

Html is used to define a document that tells the browser the current file is html document for identification.

Label defines the start and end points of the document, in between the head and the body of the document.

 

Tag two common attributes :

lang attribute:

It defines the language of element content.

 

xmlns attribute:

You can define one or more alternative namespace in the document.

 

The tag supports global attribute in HTML.

   

 

3. <head> tag

Is a container for all the elements of the head, the head of the vast majority of content labels do not appear to the reader

The lower part of the label contains a label may be added with a <base>, <link>, <meta>, <script>, <style> and <title>

The label must contain the title of the document <title> tag

   

  • <Base> tag

May default address for the page or target all links provisions,

 

 

Label two common attributes:

herf property:

To fill <a>, <img>, <link>, <form> tag in a blank portion opposite the url,

For example

As set <base> is  herf attribute is "http://www.leon9dragon.com/img/",

Then set the <img> src attribute in the tag is "test.jpg",

Eventually make the browser to retrieve pictures from this path "http://www.leon9dragon.com/img/test.jpg"

 

The target property:

By setting the target attribute to have to try is to open a new window or open a new page and other open cases in the parent window open in the current page link

For example

target = "_ blank" was to open the page in a new window, if equal "_self" covering the current window to open a new page

    

  • <Meta> tag

The purpose of the label is to tell the search engine crawlers about the content of what the site is about,

The tag attribute and search index relevant sites.    

To attribute to note:

content attributes:

To use a meta tag, this property is required

Definition on the attribute name or http-equiv meta information

Always used with the name or http-equiv attribute properties

 

The name attribute :

Associate content attribute to a name

Providing the name / value pair. This value can be any valid string

The name attribute provides the name of the name / value pair. HTML and XHTML tags do not specify any pre-defined <meta> name. Under normal circumstances, free to use meaningful names for the reader and the source document for the.

"Keywords" is a name often used for document defines a set of keywords, some search engines in the face of these keywords, the document will be classified with these keywords.

For example 

<meta name="keywords" content="HTML,ASP,PHP,SQL">

 

http-equiv attribute :

Associating the content attribute header into the HTTP

http-equiv attribute name / value pairs to provide a name. and instructs the server to contain the name of the document in the MIME header to be sent to the browser before sending the actual document / value pairs.

When the server sends a document to the browser, it will first send a number of name / value pairs, although some servers will send many of these name / value pairs, but at least all servers to send a:. Content-type:. Text / html This will tells the browser prepared to accept an HTML document. 

For example

<meta http-equiv="charset" content="iso-8859-1"> 

 

  • <Link> tag

To link external resource, and defines the relationships html documents with external resources,

The most common text for links to external style sheets,

The label should be noted that two properties:

herf property:

To define the document path

 

rel attributes:

The relationship between the provisions of the current document and the linked document (if not complete this property, you can not recognize the role of the document, the document will not be loaded)

 

  • <Script> tag

For inserting a script code, code type defined by the type attribute

You can also link to an external script file through the src attribute of the tag

 

  • <Style> tag

Css style for insertion section,

 

To pay attention to the property

property type:

There is one and only one value for the text / css, you can not write this property

 

Note : external links css file can only be achieved by <link> tag, <style> tag can be used only code inserting css

 

  • <Title> tag

Used to define the document title, this title will be displayed on the browser tabs,

May be empty (contents are empty will call a default value), but must be included in the <head> which

 

 

4. <body> tag

The body is used to define the document, it contains all the content of the document

The tag supports the global attributes and event attributes of html.

 

Is not recommended in some properties with html tags to label comes complete with CSS style of

html tag is best used only for page layout structure, not to modify the page style arrangement

Guess you like

Origin www.cnblogs.com/leon9dragon/p/11975840.html
Recommended