The front end of a paragraph based learning html learn, along with exercises

HTML paragraph

HTML documents can be divided into a plurality of passages, through passages <p> tag defined.

The following code:

<p>This is a paragraph</p>
<p>This is another paragraph</p>

Note: The browser automatically before and after paragraphs add a blank line. (<P> is a block-level element)

Tip: empty paragraph tag <p> </ p> to insert a blank line is a bad habit. Replace it with <br /> tags! (But do not use <br /> tags to create a list. Do not worry, you'll learn HTML list later in length.)

Do not forget the end tag

Even forget the end tag, most browsers will correctly displayed HTML:

The following code:

<p>This is a paragraph
<p>This is another paragraph

In the example above, most browsers no problem, but do not rely on this practice. Forgetting the end tag can produce unexpected results and errors.

Note: In future versions of HTML, it allows you to skip end tags.

Tip: to close by the end of the HTML tag is a future-proof method to write HTML. Clearly marked in an element where to start and where to end, or whether your browser, it will make the code easier to understand.

HTML wrap

If you want to wrap (new line) without generating a new paragraph, use <br /> tags:

<p>This is<br />a para<br />graph with line breaks</p>

Notes: <br /> element is an empty HTML element. Since the closing tag does not make any sense, so it does not end tag.

<br> 还是 <br />

You may find <br> and <br /> very similar.

In XHTML, XML, and future versions of HTML not allowed no end tag (closing tag) HTML elements.

Even <br> in all browsers display have no problem using <br /> also more long-term protection.

HTML Output - Useful Tips

We were unable to determine the exact effect of HTML to be displayed. Size of the screen, as well as adjustments to the window may result in different results.

For HTML, you can not add extra spaces or line breaks in the HTML code to effect change through the output.

When the display page, the browser will remove extra spaces in the source code and blank lines. All consecutive spaces or blank lines will be counted as a space. Note that all consecutive blank lines in the HTML code (line) is also shown as a blank.

The following code:

<p> 
    春眠不觉晓, 
      Everywhere Birds Are Singing. 
        Night comes wind and rain, 
          Whispering Color. 
</ p>

Output:

春眠不觉晓, Everywhere Birds Are Singing. The night comes wind and rain, Whispering Colour.

 

1. Which of the following practices regarding paragraph is correct?

A<p>This is a paragraph

B empty paragraph tag <p> </ p> to insert a blank line

C<p>This is a paragraph </p>

Create a front-end learning qun438905713, most in the group are zero-based learners, we help each other, answer each other, and also to prepare a lot of learning materials, welcomed the zero-based junior partner to the exchange.

发布了30 篇原创文章 · 获赞 19 · 访问量 1万+

Guess you like

Origin blog.csdn.net/webxuexi168/article/details/104301546