Understanding the Box Model of CSS

Source: Internet
Author: User
CSS Box Model

 

Http://lovervz.spaces.msn.com

A key concept in CSS is the box model ). The box model in css2 is the key to typographical positioning in design. Any selection operator complies with the box model specifications, such as <div>, <p>, <A> ...... The box model contains (external patch) margin, (background color) Background-color, (background image) Background-image, (inner patch) padding, (content) content, (Border) border.

Is the CSS box model:

Plane:3D (source image: hicksdesign)

 

From the outside to the inside of the box:

  • Margin margin
  • Border border
  • Padding gap (also known as Patch)
  • Content (content, such as text and images)

The CSS margin attribute (margin) is used to set the distance between the edge of an element's space and adjacent elements.

The CSS border attribute (Border) is used to set the edge of an element.

The CSS gap attribute (padding) is used to set the distance from the element content to the element border.

The CSS background attribute refers to the content and padding areas.

The width and height in the CSS attribute indicate the width and height of the content area.

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.