Examples of css box models and css box models

Source: Internet
Author: User

Examples of css box models and css box models

1. Overview of the css Box Model

1> let's take a look at w3c overview.

2> In fact, each element of css is a box (Box Model)

2.css box model type

1> w3c standard model ---------> element space width = content + border + padding + margin

2> traditional IE model (IE6-) -----> element = content (border + padding) + margin

3. Usage of box-sizing

1> attribute: box-sizing: content-box | border-box | inherit

2> usage: content-box is the default, and border-box is the traditional IE model.

3> one sentence: Use box-sizing to save layout problems

4> compatibility: IE8 +


Div + css Box Model

① Perform their respective duties. div is used to combine into a block (division), ul is used to create an unordered list, and li is the subitem of ul.
② Almost all elements in html have the "Box Model" feature, except link, style, script, mata and other elements that do not actually show.

What is the css box mode (Box Model)

You do not need to use tables for webpage layout. You can use boxes and box nesting with different sizes defined by CSS to orchestrate webpages. The webpage code in this way is concise, easy to update, and compatible with more browsers. You can add the content you want to add in the box.

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.