We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

현재 번역은 완벽하지 않습니다. 한국어로 문서 번역에 동참해주세요.


The effect of the CSS margin-top property on the element boxCSS margin-top 속성은 요소의 상단에 margin 영역을 만든다. 0보다 작은 값도 허용된다.

<tt>나 <span>과 같은 non-replaced inline 요소에는 영향을 미치지 않는다.

적용대상all elements, except elements with table display types other than table-caption, table and inline-table. It also applies to ::first-letter.
Percentagesrefer to the width of the containing block
Computed valuethe percentage as specified or the absolute length
Animation typea length
Canonical orderthe unique non-ambiguous order defined by the formal grammar


/* <길이> 값 */
margin-top: 10px;        /* 절대값 */
margin-top: 1em;         /* 글자 크기에 비례하는 길이 */
margin-top: 5%;          /* 가장 가까운 block container의 폭에 비례한다 */

/* 키워드 값 */
margin-top: auto;

/* 전역 값 */
margin-top: inherit;
margin-top: initial;
margin-top: unset;

고정된 너비 값. 가능한 값의 범위는 <length> 를 참조.
<percentage> 는 항상 요소를 포함한 block의 에 비례한다.
margin 를 참조.


<length> | <percentage> | auto


.content { margin-top:   5%; }
.sidebox { margin-top: 10px; }
.logo    { margin-top: -5px; }
#footer  { margin-top:  1em; } 


Specification Status Comment
CSS Basic Box Model
The definition of 'margin-top' in that specification.
Working Draft No significant change
CSS Transitions
The definition of 'margin-top' in that specification.
Working Draft Defines margin-top as animatable.
CSS Level 2 (Revision 1)
The definition of 'margin-top' in that specification.
Recommendation Removes its effect on inline elements.
CSS Level 1
The definition of 'margin-top' in that specification.
Recommendation Initial definition

브라우저 호환성

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 1.0 1.0 (1.7 or earlier) 3.0 3.5 1.0 (85)
auto value 1.0 1.0 (1.7 or earlier) 6.0 (strict mode) 3.5 1.0 (85)
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support 1.0 1.0 (1) 6.0 6.0 1.0

문서 태그 및 공헌자

이 페이지의 공헌자: Jinhyuk
최종 변경: Jinhyuk,