본문 바로가기

CSS3 강의/웹학교

CSS 14.Margin (기준 엘리먼트와 이웃하는 엘리먼트 사이의 여백을 할당)


※  Background-color 설정을 할 수  없다.
※  - 값을 가질 수 있다.

{
    margin-top: 100px;
    margin-bottom: 100px;
    margin-right: 150px;
    margin-left: 50px;
}




Possible Values

ValueDescription
autoThe browser calculates a margin
lengthSpecifies 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




'CSS3 강의 > 웹학교' 카테고리의 다른 글

CSS 16.Dimension  (0) 2014.12.02
CSS 15.Padding  (0) 2014.12.02
CSS 13.Outline (border바깥부분에 outline을 설정하는 법)  (0) 2014.09.15
CSS 12. Border (엘리먼트의 border)  (0) 2014.09.02
CSS 11.Box Model  (0) 2014.09.02