Home  >  Article  >  Web Front-end  >  The difference between border, margin and padding properties_CSS/HTML

The difference between border, margin and padding properties_CSS/HTML

WBOY
WBOYOriginal
2016-05-16 12:11:282576browse

The border attribute (border) is used to set the edge of an element.
The margin attribute (margin) is used to set the distance between the edge of the space occupied by an element and adjacent elements.
The gap attribute (padding) is used to set the distance from the element content to the element boundary.
These three attributes all belong to the box type attributes in CSS.

The diagram below vividly reflects the differences between the three.

Here is a 3D schematic diagram of the box model, I hope it will be easier for you to understand and remember.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn