The HTML5 specification clearly states that the use of elements should be completely from the semantics of the element. However, some of these elements are very clear, while some are more vague. In terms of the use of elements, it is best to give it to CSS to take care of it, but this is not absolute. Sometimes it only needs to keep the consistency in the HTML document.
Generate hyperlinkThe A element is used to generate a hyperlink. There are 6 local attributes: the A element: the A element:
1) HREF: Specify the URL of the resource referred to in the A element;
2) HREFLANG: Explain the language used by the resources you link;
3) Media: Explain which device is used for linked resources, and the MEDIA attributes of the style element;
4) REL: Explain the relationship between the document and the link resources, and the REL attributes of the Link element;
5) Target: Specify the browsing environment for opening the links you link;
6) Type: Explain the MIME type (such as Text/HTML).
Generate a super link to the outside<body> I like <a href = http: //en.widipedia.org/wiki/apples> Apples </a> and <a href = http: //en.wikipeida.org/wiki/orange_ (from)> oranges </a>. </Body>
The most used protocols in the URL are HTTP, but the browser also supports other protocols, such as: HTTPS and FTP. If you want to quote an email address, you can use the MailTo protocol, such as: mailto: [email protected].
Use relatively url<body> ...... You can see the other from the <a href = fruitlist.html> here </a>. </Body>
By default, the browser will assume that the target resources are at the same position as the current document, but it can be changed by providing a basic URL through the Base element.
Generate internal hyperlinksThis method is used to move another element in the unified document into the field of vision. It needs to use ID to select expression:#<ID>.
<body> ...... You can see from fruits I like <a href =#fruits> here </a>. ... <p ID = fruits> I also like bananas, mangoes, Cherries, Apricots, Plums, Peaches and Grapes. </P> </Body>
If the user clicks the link, the document will roll to the location where the ID can be seen as the FRUITS element.
Set the browsing environmentThe target attribute is used to tell the browser's hope to display the resources you link. By default, the browser uses the window, tab or window frame of the current document, so the new document will replace the document now displayed, but you can set other values:
1) _blank: Open the document in the new window or tab;
2) _Parent: Open the document in Frameset;
3) _Self: Open the document in the current window (default);
4) _top: Open the document at the top window;
5) <frame>: Open the document in the specified window frame. The <frame> here is the name of the window.
Let you understand Frame through an example. Assuming the code in the testframe.html document is as follows:
<html> <frameset color = 50%, 50%> <frame src = test.html /> <Frame name = frame1 /> < /frameset> < /html>
A Frameset is defined here, which contains two Frames, each with half a width. The first Frame points to a HTML document, and the second frame is given the name Frame1. The content of test.html is as follows:
<! Doctype html> <html Lang = EN> <gead> <meta charset = UTF-8/> <Title> Your Page Title </Title> <link Href = TEST.CSS Rel = STYLESHEET ID = TEST/> </> </> head> <body> <a I like <b> Apples </b> and <b> Orange </b>. </body>
The default style of the B element is thick.
EM elementEM elements represent a emphasis on a paragraph that can be used to provide readers with a context of sentences or paragraph meaning.
<body> <em> i </em> like <b> Apples </b> and <b> Orange </b>. </body>
The habit of the EM element is oblique. This example emphasizes i at the beginning of the sentence.
I elementI elements indicate that a paragraph of text is essentially different from the surrounding content, which is often used in foreign words, technology terms, and even someone's thoughts.
<body> <em> i </em> like <b> Apples </b> and <b> Orange </b>. My Favorite Kind of Orange is the mandarin, Properly Known as <i> Citrus RETICULATA </i >. </body>
The habit of the I element is oblique, the same as the EM element.
S elementThe S element is used to indicate that a paragraph is no longer correct or accurate. The habit style is to display a delete line in the text.
<body> <em> i </em> like <b> Apples </b> and <b> Orange </b>. My Favorite Kind of Orange is the mandarin, Properly Known as <i> Citrus RETICULATA </i >. Oranges at my Local Store Cost <s> $ 1 EANCH </s> $ 2 for 3./body>Strong element
Strong element represents an important text.
<body> I like Apples and Orange.
The style of the Strong element is the same as the B element.
U elementThe U element makes a paragraph of text highlighted from the surrounding content, but it does not mean that it emphasizes or its importance has increased. The effect is to add a line to the text.
<body> I like Apples and Orange.
Because the habits of the U element are similar to the A element, in order to prevent confusion, the U element should be avoided as much as possible.
Small elementHTML5 uses SMALL label specified rules, usually includes exemptional statements, precautions, legal restrictions, copyright information, etc. Sometimes it can be used to express the signature or meet the license requirements.
<body> <p> Order Now to Receive Free Shipping. <Small> (some restricTions may Apply.) </Small> </p> ... <fotern root = contentinfo> <p> <small> & Copy; 2013 The Super Store. All Rights Reserved. </Small> </P> </Footer> </Body>
Note: Small is only suitable for phrases. Do not use its legal statement, such as use terms and privacy policy pages.
SUB and SUP elementsSUB and SUP elements are used to indicate the subscription and subsidy, respectively.
<body> The Point x <sub> 10 </sub> is the 10 <Sup> Th </Sup> Point. </Body>
Change
There are two elements that can be used to control the content: BR and WBR elements.
BR elementBR elements will cause a change of lines. The BR element should only be used in a part of the content. Do not use it to create a paragraph or other content group.
<body> I Wandered Lonely as a Cloud <br/> That Floats on High 0'er Vales and Hills, <br/> When all at once on a crowd, <br> A host, of golden daffodils; </body "WBR element
HTML5 is added to indicate that the content that exceeds the current browser window is suitable for re -changing. Whether it is not changed by the browser is determined by the browser. The WBR element is just a suggestion for the appropriate change location.
<body> this is a very long word: super <wbr> Califragilistic <wbr> Expialidocious. </Body>
When the WBR element is not used, the browser will treat the long words as a whole, and the WBR element is used, and the browser can choose to change it at the suggestion. The use of WBR elements is to tell the browser a word most suitable where the one is the most suitable.
Represents input and output1) CODE: indicate computer code fragment
2) VAR: In the programming context, it means the variable, and it can also indicate that a reader inserts a specified place in the imagination
3) SAMP: Represents the output of the program or computer system
4) KBD: Indicates user input
<body> <p> <code> var Fruits = [Apples, Orange, Mangoes, Cherries]; <br> Document.writeln (I like + fruits.length + fruits); </code> </p> <p> The variable in this exmple is <var> FRUITS </var> </p> <p> The output from the code is: <SAMP> I like 4 fruits </sAMP> </p> <p> WHEN PROMPTED for My Favorite Fruit, I Typed: <kbd> Cherries </kbd> </body>Use title reference, quotation, definition and abbreviation ABBR element
Express the abbreviation, its Title attribute represents the complete word representing the abbreviation.
<body> I like Apples and Oranges. The <AbBR <p> The </P> </body>
This element is not accustomed to style, so its content does not look special.
Q elementRepresents the content of him. The cite attribute of the Q element can be used to specify the URL of the source article.
<body> <p> <q cite = http: //en.wikipedia.org/wiki/apple> The <dfn </p> </body>
The habit of the Q element is to generate quotes before and after the citation.
cite elementRepresents the title of the quoted work.
<body> My Favorite Book on Fruit is <Cite> FRUIT: Edible, INEDIBLE, Incredible </cite> by Stuppy & Kesseler </body>
Its habit is oblique.
Language element Ruby, RT and RP elementsRuby element represents a text containing a phonetic symbol, which needs to be used with RT elements and RP elements. RT elements are used to mark phonetic symbols, and RP elements are used to label the browser that does not support the phonetic symbol characteristics. Essence
<body> <Ruby> 魑 <RP> (</rp> <RT> Chi </rt> <RP>) </RP> </Ruby> <RP> (</rp> <RT> mei </rt> <RP>) </rp> </ruby> </body>
When the browser that shows a phonetic symbol, the RP element and its content will be ignored, and the content of the RT element will be displayed as a phonetic symbol. The document is displayed in a browser that does not support a phonetic symbol, and the content of RP and RT elements will be displayed.
BDO elementIt is used to set the direction of the Chinese characters. BDO elements must be added with DIR attributes, and the support value is: 1) RTL (from right to left); 2) LTR (from left to right).
<body> <p> This is left-to-right: <bdo Dir = LTR> I like oranges </bdo> </p> <p> This is right-seo-sele OrangeS </bdo> </p> </body>Other text elements span element
There is no meaning itself, and it is usually used to apply some global attributes to a paragraph.
<body> I like <span class = fruit> Apples </span> and <span class = fruit> orange </span>. </body>mark element
HTML5 is added, which is used to indicate a paragraph that is prominently displayed due to a certain context.
<body> <p> I will like a <mark> Pair </Mark> of <mark> People </Mark> </P> </Body>INS element and Del element
INS elements and Del elements can be used to represent text added and deleted in the document.
<body> <p> <del> I can </mark> the <mark> see </mark> </del> <ins> I can <mark> see </mark> the <mark> sea </mark> </ins> </p> </body>Time element
Represents time and date. If the Boolean attribute Pubdate exists, then the Time element represents the release date of the entire HTML document or the most of the Article element from the element. Datetime attributes specify the date and time specified in the format specified in the RFC3339. With DateTime, you can set the date or time in the form of the element to facilitate reading, and at the same time ensure that the computer can analyze the specified date or time without ambiguity.
<body> I Still ReMember The Best Apple I Ever Tasted. I Bought It at <Time Datetime = 15: 00> 3 O'Clock </Time> On <Time Datetime = 1984-12-7> December " . </body>
Time elements may not include the DateTime property. At this time, the time and date of the readable format that must be provided with valid machines. When the time and date format is irregular, the data attribute needs to be used to specify the text content of the text content.
The above is all the contents of this article. I hope it will be helpful to everyone's learning. I also hope that everyone will support VEVB Wulin.com.