HTML Note (ii) HTML tag elements

Source: Internet
Author: User
Tags basic html page

a common head element tag

  The

1. <title>

The <title> tag defines the title of the HTML document, which is required in the html/xhtml document.

Main functions:

    • Defines the title of the browser toolbar;
    • The title that appears in the favorites when the page is added to the Favorites folder;
    • The title displayed on the search engine results page;
2. <base>

The <base> tag describes the basic link address or link target.

The label is the default link for all the link labels in the HTML document, that is, if the hyperlink tag in the HTML document does not have a link address added, the link in the <base> tag is accessed by default.

Syntax format: <base href= "url" target= "..." >

3. <link>

The <link> tag defines the relationship between a document and an external resource, and is often used to link to an external style sheet.

Syntax format: <link rel= "stylesheet" type= "Text/css" href= "Xxx.css" >

4. <style>

The <style> tag defines the internal CSS style.

Syntax format: <style type= "text/css" >css style rules </style>

5. <meta>

The <meta> tag describes some basic HTML page metadata, which is not displayed on the page but is parsed by the browser.

<meta> elements are typically used to develop a description of the Web page, keywords, last modified time of the file, author, and other meta-data.

There are mainly http-equiv, name, and content three properties. The first two specifies the name of the metadata information, and the content is used to specify the corresponding value.

Example: <meta http-equiv= "Content-type" content= "text/html;charset=" Utf-8 "/>

<meta name= "Author" content= "Lovestory_fish"/>

6. <script>

<script> tags are used to load script files.

7, the head tag element use instance
<! DOCTYPE html>{color: Blue}    </style>    <!--definition Web page language--    <meta charset= "Utf-8"/>    <!--definition page author--    <meta name= "Author" content= "Lovestory_fish"/>    <!--refresh the current page every 30 seconds-    <meta http-equiv= "Refresh" content= ""/>    <!--execute JavaScript script code    --<script type= "Text/javascript" >    Alert ("Hello world! ") </script>       

Two commonly used block-level element tags

A block-level element in the browser that displays a folded line before and after it.

  Features of block-level elements:

    • Block-level elements, the front and rear display of the line, starting from the new line, the following elements need another row;
    • The height, width, line height, upper and lower margin of the element can be set;
    • You can convert row-level elements to block-level elements by Display:block property key-value pairs;
1. Title Tag

HTML defines a title by

Font size by importance ,

  the importance of headings: search engines use headings to index the structure and content of a Web page, and users can quickly navigate through the Web by heading.

2. <p>

The paragraph used to define the HTML document.

3,

Defines the horizontal line of an HTML document, which is typically used to split content.

4. <div>

The partition label of an HTML document, which is used as a structured block element of an HTML document.

Used as a container for the overall block layout of a Web page.

5, row-level element tag use example

  Note: In general, the spacing between paragraphs and paragraphs is greater than the line spacing of the wrapping.

<!DOCTYPE HTML><HTML><Head>    <MetaCharSet= "Utf-8">    <title>This is my first HTML</title></Head><Body>    <!--HTML comments, which are not displayed in the browser -    <!--HTML title -    <H1>My first title</H1>    <H2>My first title</H2>    <H3>My first title</H3>    <h4>My first title</h4>    <h5>My first title</h5>    <h6>My first title</h6>    <!--HTML Horizontal Line -    <HR/>    <!--HTML paragraph -    <P>this is a paragraph! <!--HTML Wrapping -    <BR/>This is part of the paragraph ...</P>
<div> <P>This is another paragraph!</P>
</div>
</Body></HTML>
Three common line-level element labels

Row-level elements are typically displayed on a row-by-line basis and do not wrap around.

  Characteristics of row-level elements:

    • displayed on a line with other elements;
    • element height, width, line height, upper and lower margins cannot be set, width is the width of the content it contains;
    • Block-level elements can be converted to block-level elements by Display:inline property key-value pairs;
1. <a>

A hyperlink that defines an HTML document.

Hyperlinks can be text or an image that can be clicked to jump to a new page or to a section of the current page.

Syntax format: <a href= "link address" target= "target Window" > link text or Picture </a>

(1) HREF attribute

The href attribute is used to describe the address or destination of a link.

  Note: Whenever possible, use a forward slash to a subfolder, and if you use a backslash, it will generate two HTTP requests to the server because the server adds a forward slash to the address and then creates a new request.

(2) Target property

The target property can define where the linked document is displayed.

_blank: Play in a new window

2, <br/>

Defines a broken line for an HTML document, which is an empty HTML element if it is used without creating a new paragraph and wrapping is required.

3. Formatting tags

The formatted label allows you to format the output text.

(1) Commonly used text formatting tags
Label Describe
<b> Define bold text
<strong> Define bold text to highlight important textual content
<i> Define italic text
<em> Define italic text to highlight important text content
<small> Define Small words
<big> Define large characters
<sub> Define Subscript
<sup> Define Superscript
<ins> Defining Insert Words
<del> Define Delete words
(2) commonly used computer output label
Label Describe
<code> Defining computer code
<kdd> Defining keyboard Codes
<samp> Defining a sample of computer code
<var> Defining variables
<pre> Define and format text, control blank lines and spaces (will remain)
(3) Common citations, citation tags
Label Describe
<abbr> Defining abbreviations
<address> Define Address
<bdo> Define text orientation
<blockquote> Define a long reference
<q> Define a short reference
<cite> Define references, citations
<dfn> Define a definition Project
(4) text formatting examples:
<body>    <b> text bold </b><br/>    <strong> text Bold (accent) </strong><br/>    <i> text Italic </i><br/>    <em> text italic (accent) </em><br/>    <big> text Amplification </big ><br/>    <small> Text reduction </small><br/>     text <sup> superscript </sup><br/>     text <sub> subscript </sub><br/>    <pre>         control of contiguous spaces     and Blank lines    < /pre>    <p> This paragraph of text is displayed from right to left </p>    <p><bdo dir= "RTL" > This paragraph of text is displayed from right to left </p>     Delete error fonts <del> "Arial" </DEL>, new fonts <ins> XXFarEastFont-</ins><br/></body>   

Operation Result:

  

4. <span>

Defines an inline area within an HTML document that can be divided into multiple regions by <span>.

Four common inline block-level elements 1,

Defines an image in an HTML document.

is an empty label that contains only attributes and no closed tags.

Syntax format:

(1) SRC attribute

The URL address used to define the image.

The value of the SRC attribute refers to the location of the image where the image appears in the document where the image label appears.

(2) ALT attribute

The ALT attribute is used to define a string of prepared, replaceable text for an image, and the substituted Text property value is user-defined.

When the browser is unable to load the image, the browser will display this alternative text.

(3) Height and Width properties

The height and Width properties, respectively, are used to set the elevation and width of the image, and the default unit of the property value is px.

Specifies the height and width of the image, which retains the specified size when the page is loaded, and if you do not specify a picture size, it may break the overall layout of the HTML page when the page is loaded.

  Note: It takes time to load images and use them sparingly. and need to pay attention to the path of the page image, if the image can not be set correctly, the browser can not load the picture, will show a broken picture.

2. examples of linking and picture use:
<Body>text Link:<ahref= "http://www.google.cn">Link</a>    <BR/>Photo Link:<ahref= "http://www.google.cn">        <imgsrc= "Google. JPG "alt= "Goole icon"Height= "+"width= "+">    </a></Body>
Five notes

HTML annotations can improve the readability of HTML documents, making the code easier to understand.

The browser ignores comments and does not display them.

Syntax format:<!--annotation Content--

  Note: when the page is displayed, the browser removes extra spaces and blank lines from the source code, and all contiguous spaces or blank lines are counted as a space, and all successive blank lines in the HTML code are displayed as a single space.

  Instance:

<!DOCTYPE HTML><HTML><Head>    <MetaCharSet= "Utf-8">    <title>This is my first HTML</title></Head><Body>    <H1>Chunxiao</H1>    <P>Spring sleep does not feel xiao, everywhere smell bird.    The night comes the wind and rain, the flowers fall to know how much. </P></Body></HTML>

  Operation Result:

HTML Note (ii) HTML tag element

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.