dir
시도해보기
dir
전역 특성은 요소의 쓰기 방향을 나타내는 열거형 특성입니다.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
가능한 값은 다음과 같습니다.
ltr
은 왼쪽에서 오른쪽을 뜻하며, 좌횡서 언어인 한국어나 영어에 사용합니다.rtl
은 오른쪽에서 왼쪽을 뜻하며, 우횡서 언어인 아랍어 등을 사용합니다.auto
는 사용자 에이전트가 결정합니다. 사용자 에이전트는 기본적인 알고리즘을 사용해 요소 내부의 문자를 분석한 후, 명확한 방향성을 가진 문자가 존재하는 경우 전체 요소에 해당 방향성을 적용합니다.
참고: dir
특성은<bdo>
요소에 필수로 지정해야 하며, 다른 뜻을 가집니다.
-
<bdi>
(en-US) 요소는dir
특성을 상속하지 않으며, 지정하지 않은 경우auto
를 기본값으로 사용합니다. -
direction
(en-US)과unicode-bidi
(en-US)를 지원하며 CSS를 활성화한 경우, 특성 값은 무시하고 CSS 값을 대신 사용합니다. -
글자의 쓰기 방향은 외형이 아니라 그 의미에 관여하므로, 웹 개발자로서 되도록 CSS 속성 대신
dir
특성을 사용하세요. 관련 속성을 지원하지 않거나, CSS를 비활성화한 브라우저에서도 텍스트가 올바른 방향으로 나타납니다. -
데이터베이스에 저장된 사용자 입력 값처럼 방향성을 알 수 없는 데이터에는
auto
값을 사용해야 합니다.
명세
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'dir' in that specification. |
Living Standard | No change from latest snapshot, HTML 5.1 |
HTML 5.1 The definition of 'dir' in that specification. |
Recommendation | Snapshot of HTML Living Standard, no change from HTML5 |
HTML5 The definition of 'dir' in that specification. |
Recommendation | Snapshot of HTML Living Standard, from HTML 4.01 Specification it added the auto value, and is now a true global attribute. |
HTML 4.01 Specification The definition of 'dir' in that specification. |
Recommendation | Supported on all elements but <applet> , <base> , <basefont> (en-US), <bdo> , <br> , <frame> , <frameset> , <iframe> , <param> , and <script> . |
브라우저 호환성
BCD tables only load in the browser
같이 보기
- 모든 전역 특성.
- 이 특성을 나타내는
HTMLElement.dir
(en-US).