HTML Start-Learning 2

Source: Internet
Author: User

1.HTML elements

1. What are HTML elements

The HTML element refers to all the code from the start tag (start tag) to the end tag (end tag). HTML pages are actually text files made up of many different HTML elements, and any Web browser can run HTML files directly. So it can be said that HTML elements are the basic objects that make up HTML files, HTML elements can be said to be a generic. HTML elements are defined by using HTML tags.

< start tag > element content < end tag >

This is an element:

1 < P >shiyanlou</p>

2.HTML element syntax

HTML element syntax features:

    • HTML element to start tag starting
    • HTML element terminated with end tag
    • The content of an element is the content between the start tag and the end tag
    • Some HTML elements have blank content (empty contents)
    • Empty elements are closed in the start tag (ending with the end of the start tag)
    • Most HTML elements can have attributes (as you can tell below)

3.HTML Element Nesting Example

There are several elements in the following example:

 1  <  html  >  2  <  body  >  3  <  p  >  let's go to shiyanlou< Span style= "COLOR: #0000ff" ></ p  >  4  </ body  >  5  </  HTML  >  

The answer, of course , is three, which should be well understood, which is called nesting

4.HTML empty Element

The content of an HTML element is the content between the start tag and the end tag, and some HTML elements have empty content, which is called an empty element. such as line breaks <br> . But <br> is not the standard wording, the earlier published HTML specification, <br> , and other markup elements do not need to "close themselves", which caused the HTML specification itself is not rigorous, so later reference to the syntax of the more standardized XML language introduced XHTML. All <br> such orphaned tags in XHTML need to be closed by themselves, with a "/" behind the tag name, for example <br/> . Logically <br />=<br>...</br> , this is done in order to minimize the amount of code on the Web page, while maintaining a rigorous logic.

Pull so much is to say, please keep the specification of the wording, after the line please use <br/> .

As we can see from the example above, <p> after the end of the label, there is a line action, < p> What is the difference between the label and the < br/> label?

    • The similarities are that <br> and <p> are both properties and functions that have line breaks
    • The difference <br/> is just a single use, while <p> and </p> are a pair of use
    • <br/> tag is a small newline bhakta (equivalent to our usual text input a carriage return),<p> tag is a big line break (segmented, quite with two carriage returns), each row functions.

Take a look at the difference between the two labels first <br/> newline,

1  < P > 2         < BR /> 3         I am so happy<br/>4Let's         go to Shiyanlou.  <br/>5     </p>

Another <p></p>.

1  < P >long time to see. </ P > 2     < P >I am so happy. </ P > 3     < P >Let's go to Shiyanlou. </ P >

The above code effect is different, if the same, such as the use of <br/>:

1  <P>2Hello Shiyanlou<BR/><BR/>3I am so happy<BR/><BR/>4Let's go to Shiyanlou.<BR/><BR/>5     </P>
2.HTML Properties

Some labels want to follow the author's wishes to implement on the Web page, you need to add a certain amount of information, this information is called attributes, HTML tags can be added attribute description. The properties provide more information about the HTML element.

There are the following syntax rules for attributes:

    • is defined in the start tag of the HTML element.
    • Always appears in the form of a name and value, for example: Name= "value".
    • Property values should always be included in quotation marks. Double quotes are the most common, but there is no problem with single quotes.
1 <  href= "http://www.shiyanlou.com">shiyanlou</a  >

href="http://www.shiyanlou.com", this section is called the < a> Tag property, which is a supplemental description of the < a> tag, pointing to the Web page.

3.HTML text formatting

In general, we can see in the page a variety of fonts, text styles, which is the credit of the text formatting tags. Let's learn to use text formatting tags (more commonly used)

label Description
< b> (bold) Bold
< big> (big) Large font
< em> (emphasized) Accent words
< i> (italic) Italic
< small> (small) Small font
< strong> (strong) Aggravating tone
4.HTML style

We used a variety of tags to make the HTML text format conform to our wishes, in fact, there is a property can help us reduce a lot of trouble.

Style provides a common way to change the style of all HTML elements. Here, the background color, font style, font size, font color, and alignment are defined as well.

HTML Start-Learning 2

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.