Box model--width and height

Source: Internet
Author: User

The width and height of the box model is not the same as the width and height of the object we normally speak of, the width (width) and high (height) defined within the CSS, which refers to the content range filled in.

So the actual width of an element (width of box) = left border + Left box + Left padding + content width + right padding + right Border + right edge.

The height of the element is also the same.

Like what:

CSS code:

div{    width:200px;    padding:20px;    border:1px solid red;    margin:10px;    }

HTML code:

< Body >   < Div > text content </div></body>

The actual length of the element is: 10px+1px+20px+200px+20px+1px+10px=262px. The element box model can be viewed under Chrome browser, such as:

Box model--width and height

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.