text-align
Baseline
Widely available
*
This feature is well established and works across many devices and browser versions. Itâs been available across browsers since 2015ë 7ì.
* Some parts of this feature may have varying levels of support.
CSS text-align ìì±ì ë¸ë¡ ììë íì 칸 ììì ê°ë¡ ì ë ¬ì ì¤ì í©ëë¤. ì¦ vertical-alignê³¼ ëì¼íë ì¸ë¡ê° ìë ê°ë¡ ë°©í¥ì¼ë¡ ëìí©ëë¤.
ìëí´ ë³´ê¸°
text-align: start;
text-align: end;
text-align: center;
text-align: justify;
<section id="default-example">
<div id="example-element">
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
est laborum.
</p>
</div>
</section>
section {
font-size: 1.5em;
}
#default-example > div {
width: 250px;
}
구문
/* í¤ìë ê° */
text-align: left;
text-align: right;
text-align: center;
text-align: justify;
text-align: justify-all;
text-align: start;
text-align: end;
text-align: match-parent;
/* í ì´ì 문ì ê¸°ë° ì ë ¬ */
text-align: ".";
text-align: "." center;
/* ë¸ë¡ ì ë ¬ ê° (ë¹íì¤ êµ¬ë¬¸) */
text-align: -moz-center;
text-align: -webkit-center;
/* ì ì ê° */
text-align: inherit;
text-align: initial;
text-align: unset;
text-align ìì±ì ë¤ì ë°©ë² ì¤ íë를 ì¬ì©í´ ì§ì í©ëë¤.
ê°
start-
ì°ê¸° ë°©ìì´ ì¢í¡ìë©´
leftì ê°ê³ , ì°í¡ìë©´rightê³¼ ê°ìµëë¤. end-
ì°ê¸° ë°©ìì´ ì¢í¡ìë©´
rightê³¼ ê°ê³ , ì°í¡ìë©´leftì ê°ìµëë¤. left-
ì¸ë¼ì¸ ì½í ì¸ ë¥¼ ì¤ ììì ì¼ìª½ 모ìë¦¬ë¡ ì ë ¬í©ëë¤.
right-
ì¸ë¼ì¸ ì½í ì¸ ë¥¼ ì¤ ììì ì¤ë¥¸ìª½ 모ìë¦¬ë¡ ì ë ¬í©ëë¤.
center-
ì¸ë¼ì¸ ì½í ì¸ ë¥¼ ì¤ ììì ê°ì´ë°ë¡ ì ë ¬í©ëë¤.
justify-
ì¸ë¼ì¸ ì½í ì¸ ë¥¼ ì쪽 ì ë ¬í©ëë¤. ë§ì§ë§ ì¤ì ì ì¸íê³ , ì¤ ììì ì¼ìª½ê³¼ ì¤ë¥¸ìª½ ëì í ì¤í¸ë¥¼ ë§ì¶ê¸° ìí´ ì¬ì´ ê³µê°ì ëìëë¤.
justify-all-
justifyì ê°ì§ë§ ë§ì§ë§ ì¤ìë ì ì©í©ëë¤. match-parent-
inheritê³¼ ë¹ì·íì§ë§,startìendê°ì ë¶ëª¨ìdirectionì ë§ì¶° ì ì íleftìrightê°ì¼ë¡ ì¹íí©ëë¤. <string>-
í 칸ì ì ì©í ê²½ì°, 칸ì ì½í ì¸ ë¥¼ í´ë¹ 문ìì ë§ì¶° ì ë ¬í©ëë¤.
ì ê·¼ì± ê³ ë ¤ì¬í
ì쪽 ì ë ¬ ì ì© ì ì기ë ë¶ê·ì¹í ì¬ë°±ì ëë ì¦ ë± ì¸ì§ë ¥ ì í를 ê²ªê³ ìë ì¬ì©ììê² ë¬¸ì ê° ë ì ììµëë¤.
íì ì ì
| ì´ê¸°ê° | start, or a nameless value that acts as left if direction is ltr, right if direction is rtl if start is not supported by the browser. |
|---|---|
| ì ì©ëì | block containers |
| ìì | yes |
| ê³ì° ê° | as specified, except for the match-parent value which is calculated against its parent's direction value and results in a computed value of either left or right |
| Animation type | discrete |
íì 구문
text-align =
start |
end |
left |
right |
center |
<string> |
justify |
match-parent |
justify-all
ìì
>ì¼ìª½ ì ë ¬
HTML
<p class="example">
Integer elementum massa at nulla placerat varius. Suspendisse in libero risus,
in interdum massa. Vestibulum ac leo vitae metus faucibus gravida ac in neque.
Nullam est eros, suscipit sed dictum quis, accumsan a ligula.
</p>
CSS
.example {
text-align: left;
border: solid;
}
ê²°ê³¼
ê°ì´ë° ì ë ¬
HTML
<p class="example">
Integer elementum massa at nulla placerat varius. Suspendisse in libero risus,
in interdum massa. Vestibulum ac leo vitae metus faucibus gravida ac in neque.
Nullam est eros, suscipit sed dictum quis, accumsan a ligula.
</p>
CSS
.example {
text-align: center;
border: solid;
}
ê²°ê³¼
ì쪽 ì ë ¬
HTML
<p class="example">
Integer elementum massa at nulla placerat varius. Suspendisse in libero risus,
in interdum massa. Vestibulum ac leo vitae metus faucibus gravida ac in neque.
Nullam est eros, suscipit sed dictum quis, accumsan a ligula.
</p>
CSS
.example {
text-align: justify;
border: solid;
}
ê²°ê³¼
ì°¸ê³
ì¸ë¼ì¸ ì½í
ì¸ ë¥¼ ê°ì´ë° ì ë ¬íì§ ìê³ ìì ì ì ë ¬íë ë²ì marginì autoë¡ ì¤ì íë ê²ì
ëë¤.
.something {
margin: auto;
}
.something {
margin: 0 auto;
}
.something {
margin-left: auto;
margin-right: auto;
}
ëª ì¸
| Specification |
|---|
| CSS Logical Properties and Values Module Level 1 > # text-align > |
| CSS Text Module Level 3 > # text-align-property > |