MENU service case
 Website construction website design Beijing website construction high-end website production company Shangpin China
We create by embracing change
360 ° brand value__
simplified Chinese character
Simplified Chinese English

Shangpin China Joins Hands with Beisheng Internet to Create a New Chapter in Website Construction

Type: Shangpin Dynamic Learn more

Website construction - detailed explanation of front-end CSS block elements and inline elements

Source: Shangpin China | Type: website encyclopedia | Time: March 6, 2019

In the css box model, we mentioned block elements and inline elements in html elements. So what are they?

      Block elements are generally container elements of other elements, which can accommodate other block elements or inline elements. P tag and DIV tag are common. The block element is like a square block, which can be placed with other four blocks and displayed anywhere on the page.

Let's take the div tag as an example, Set a style of "200px in width and 200px in height and red in background color" for the div tag to get a square of 200px in width and height, as shown below:

Try to add another div tag and add the margin bottom margin to distinguish their positions. Next, remove the width. You can see that the width has widened. From the left to the right of the browser, there are two red blocks that appear line by line as if they are overbearing, as shown in the following figure:

From this, we know the characteristics of block elements:

          1. If the width is not set, the default line is full
              2. Default block element is not in one line
3. Support all CSS commands

Inline elements are also called inline elements or inline elements. Inline elements can only contain text or other inline elements. Common inline elements include a and span.

Take span tags as an example, add three span tags, and set the style of "width height 200px, background color red margin10px", It is found that it is not displayed as 200 * 200, and the margin tag has not changed from top to bottom. From this, the reference block element can be seen that:

Properties of inline elements:

           1. The width and height are stretched by the content

2. Width and height are not supported

3. Labels of the same type can continue to be displayed on one line

4. The upper and lower features of the margin are not supported

5. Code newline is parsed

This article comes from Shangpin China: Website construction
Source Statement: This article is original or edited by Shangpin China's editors. If it needs to be reproduced, please indicate that it is from Shangpin China. The above contents (including pictures and words) are from the Internet. If there is any infringement, please contact us in time (010-60259772).
TAG label:

What if your website can increase the number of conversions and improve customer satisfaction?

Make an appointment with a professional consultant to communicate!

* Shangpin professional consultant will contact you as soon as possible

Disclaimer

Thank you very much for visiting our website. Please read all the terms of this statement carefully before you use this website.

1. Part of the content of this site comes from the network, and the copyright of some articles and pictures involved belongs to the original author. The reprint of this site is for everyone to learn and exchange, and should not be used for any commercial activities.

2. This website does not assume any form of loss or injury caused by users to themselves and others due to the use of these resources.

3. For issues not covered in this statement, please refer to relevant national laws and regulations. In case of conflict between this statement and national laws and regulations, the national laws and regulations shall prevail.

4. If it infringes your legitimate rights and interests, please contact us in time, and we will delete the relevant content at the first time!

Contact: 010-60259772
E-mail: [email protected]

Communicate with professional consultants now!

  • National Service Hotline

    400-700-4979

  • Beijing Service Hotline

    010-60259772

Please be assured to fill in the information protection
Online consultation

Disclaimer

Thank you very much for visiting our website. Please read all the terms of this statement carefully before you use this website.

1. Part of the content of this site comes from the network, and the copyright of some articles and pictures involved belongs to the original author. The reprint of this site is for everyone to learn and exchange, and should not be used for any commercial activities.

2. This website does not assume any form of loss or injury caused by users to themselves and others due to the use of these resources.

3. For issues not covered in this statement, please refer to relevant national laws and regulations. In case of conflict between this statement and national laws and regulations, the national laws and regulations shall prevail.

4. If it infringes your legitimate rights and interests, please contact us in time, and we will delete the relevant content at the first time!

Contact: 010-60259772
E-mail: [email protected]