Div + CSS basic Tutorial: Box Model

Source: Internet
Author: User
The box model is the core of the XHTML + CSS layout page! To learn how to layout pages with CSS, you must first understand the box model!


What is a box model? For beginners, it is hard to say, but you are familiar with boxes in life. Haha, you can understand the box model mentioned here as a box in real life, otherwise, how can we create a model named "Box Model "?


Good! Since it is the same as the box in real life, let's think about whether the box in life is empty and easy to store, in the area where the content is stored, we give him a name called "content", while the paper wall of the box gives him a name called "border )", if something inside the box is like a hard disk, but the hard disk is afraid of vibration, we need to evenly fill the box around the hard disk with shockproof materials, at this time, there is a certain distance between the hard disk and the border of the box. We call this distance "padding (internal margin)". If we need to buy many hard disks, because the hard disk is afraid of vibration, some shockproof materials need to be filled between the box and the box, so the distance between the box and the box is called "margin (margin )"


OK ~! The four elements of the box model are as follows:Content, border, padding, and margin), Such




Our page is composed of many boxes ~~~, But in real life, we will ignore the margin (margin) in the box, but in the page, we cannot ignore the margin (margin, only the box model that includes the outer margin is complete in CSS. Even if the outer margin is zero, we should not ignore it and know that it exists.


How can I understand the "Box Model? That's the point of knowledge.


Author: kwoojan from: CSS Learning Forum

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.