CSS margin-right 속성
예시
<p> 요소의 오른쪽 여백을 150픽셀로 설정합니다.
p.ex1 {
margin-right: 150px;
}
아래에서 더 많은 "직접 사용해 보기" 예를 살펴보세요.
정의 및 사용
속성 은 margin-right
요소의 오른쪽 여백을 설정합니다.
참고: 음수 값이 허용됩니다.
기본값: | 0 |
---|---|
상속: | 아니요 |
애니메이션 가능: | 예, 개별 속성을 참조하십시오 . 애니메이션 가능 에 대해 읽기 |
버전: | CSS1 |
자바스크립트 구문: | 개체 .style.marginRight="100px" |
브라우저 지원
표의 숫자는 속성을 완전히 지원하는 첫 번째 브라우저 버전을 지정합니다.
Property | |||||
---|---|---|---|---|---|
margin-right | 1.0 | 6.0 | 1.0 | 1.0 | 3.5 |
CSS 구문
margin-right: length|auto|initial|inherit;
속성 값
Value | Description | Play it |
---|---|---|
length | Specifies a fixed right margin in px, pt, cm, etc. Default value is 0px. Read about length units | |
% | Specifies a right margin in percent of the width of the containing element | |
auto | The browser calculates a right margin | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
더 많은 예
예시
<p> 요소의 오른쪽 여백을 컨테이너 너비의 50%로 설정합니다.
p.ex1 {
margin-right: 50%;
}
예시
<p> 요소의 오른쪽 여백을 15em으로 설정합니다.
p.ex1 {
margin-right: 15em;
}
관련 페이지
CSS 튜토리얼: CSS 여백
HTML DOM 참조: marginRight 속성