CSS3 강의/웹학교
CSS 14.Margin (기준 엘리먼트와 이웃하는 엘리먼트 사이의 여백을 할당)
hookbox
2014. 9. 17. 01:33
※ Background-color 설정을 할 수 없다.
※ - 값을 가질 수 있다.
p {
margin-top: 100px;
margin-bottom: 100px;
margin-right: 150px;
margin-left: 50px;
}
margin-bottom: 100px;
margin-right: 150px;
margin-left: 50px;
}
Possible Values
| Value | Description |
|---|---|
| auto | The browser calculates a margin |
| length | Specifies a margin in px, pt, cm, etc. Default value is 0px |
| % | Specifies a margin in percent of the width of the containing element |
| inherit | Specifies that the margin should be inherited from the parent element |
The margin property can have from one to four values.
- margin: 25px 50px 75px 100px;
- top margin is 25px
- right margin is 50px
- bottom margin is 75px
- left margin is 100px
- margin: 25px 50px 75px;
- top margin is 25px
- right and left margins are 50px
- bottom margin is 75px
- margin: 25px 50px;
- top and bottom margins are 25px
- right and left margins are 50px
- margin: 25px;
- all four margins are 25px