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