Elements within a CSS block and inline elements

Source: Internet
Author: User

In-line elements (inline element), also called inline elements;

Inline elements can hold text or other inline elements, and common inline elements include <span>, <a>, <input>.

Block element:

Block elements are generally started from new rows, and can hold text, other inline elements, and other block elements.

Even if the content is not a row, block elements to fill the entire row, and will be wrapped to show that the common block elements are <div>, <p>.

Some CSS properties may not take effect on inline elements, which is related to the browser's version and type, so use block element positioning whenever possible.

Cases:



<TITLE>CSS block elements and inline elements </title>
<body>
<div style= "Background-color:gray" ><span style= "Background-color:pink" >www.bianceng.cn</span> </div>
</body>

You can see the effect, in this case, the block element (<div> Element) fills the entire row, and the inline element only takes up the width of its content and does not occupy the entire row.

The effect of the following figure:

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/web/Css/

Related Article

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.