1 개요[ | ]
- CSS text-align Property
- CSS text-align 속성
- 텍스트 수평 정렬 방식을 지정하는 CSS 속성
html
Copy
text-align: left|right|center|justify|initial|inherit;
값 | 설명 |
---|---|
left | 왼쪽 정렬 |
right | 오른쪽 정렬 |
center | 가운데 정렬 |
justify | 양쪽정렬 |
initial | 기본값 사용 |
inherit | 부모 요소의 속성 상속 |
2 예시[ | ]
html
Copy
<style>
div { width: 300px; border: 1px solid brown; }
div:nth-of-type(1) { text-align:left; }
div:nth-of-type(2) { text-align:right; }
div:nth-of-type(3) { text-align:center; }
div:nth-of-type(4) { text-align:justify; }
</style>
<div>S4 그룹: 12-크라운-4, tetrabromoneopentane<br>S6 그룹: 18-크라운-6, bis(9-ane-S3)copper(II)</div>
<div>S4 그룹: 12-크라운-4, tetrabromoneopentane<br>S6 그룹: 18-크라운-6, bis(9-ane-S3)copper(II)</div>
<div>S4 그룹: 12-크라운-4, tetrabromoneopentane<br>S6 그룹: 18-크라운-6, bis(9-ane-S3)copper(II)</div>
<div>S4 그룹: 12-크라운-4, tetrabromoneopentane<br>S6 그룹: 18-크라운-6, bis(9-ane-S3)copper(II)</div>