텍스트 정렬과 장식
text-left, text-center, text-right로 텍스트를 정렬하고 밑줄, 취소선, 대문자 변환과 같은 변형을 추가합니다.
텍스트 정렬과 장식은(는) CoddyKit의 무료 Tailwind CSS Academy 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Tailwind CSS Academy 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Tailwind CSS Academy 강의에는 총 4개의 강의가 포함되어 있습니다.
텍스트 정렬 기초
정렬로 텍스트의 위치를 지정하세요. text-left(기본값), text-center, text-right, text-justify가 있습니다. 가운데 정렬은 격식 있는 느낌을 주고, 왼쪽 정렬은 긴 문단을 읽기에 가장 편합니다.
<p class="text-left">Left-aligned (default for LTR text)</p>
<p class="text-center">Center-aligned (good for headings, CTAs)</p>
<p class="text-right">Right-aligned (good for numbers, dates)</p>
<p class="text-justify">Justified text (edges align to container sides)</p>정렬별 사용 시점
목적에 따라 정렬을 선택하세요. 주요 헤드라인에는 text-center, 본문과 양식에는 text-left, 가격과 날짜에는 text-right를 사용합니다. 텍스트가 빽빽한 경우에는 text-justify를 피하세요.
<div class="text-center mb-8">
<h1 class="text-4xl font-bold">Centered Hero Headline</h1>
<p class="text-lg text-gray-500 mt-2">Centered subtitle works for marketing.</p>
</div>
<article class="text-left">
<p class="text-base text-gray-700 leading-relaxed">
Body text always reads better left-aligned.
</p>
</article>반응형 텍스트 정렬
화면 크기에 따라 정렬을 변경할 수 있습니다. 주요 영역은 모바일에서 text-center로 표시하고 데스크톱에서는 text-left로 표시할 수 있습니다. 해당 크기에서 재정의하려면 중단점 접두사를 추가하세요.
<!-- Centered on mobile, left-aligned on large screens -->
<div class="text-center lg:text-left">
<h1 class="text-3xl font-bold">Responsive Heading</h1>
<p class="text-gray-500">Aligns with the layout at each breakpoint.</p>
</div>텍스트 장식: 밑줄
장식으로 선을 추가하세요. 링크에는 underline, 취소된 항목에는 line-through, 탐색 링크의 기본 밑줄을 제거할 때는 no-underline을 사용합니다.
<a href="#" class="underline text-blue-600">Standard link with underline</a>
<a href="#" class="no-underline text-gray-700 hover:underline">Nav link (underline on hover)</a>
<span class="line-through text-gray-500">$99.00</span>
<span class="text-red-600 font-bold">$59.00</span>밑줄 스타일과 색상
밑줄 스타일을 세밀하게 지정할 수 있습니다. decoration-dotted, dashed, wavy로 모양을 바꾸고, decoration-{color}로 색상을 설정하며, decoration-2 또는 decoration-4로 두께를 지정합니다.
<p class="underline decoration-dotted decoration-indigo-500">Dotted indigo underline</p>
<p class="underline decoration-wavy decoration-red-500 decoration-2">Wavy red underline</p>
<p class="underline decoration-double decoration-4">Double thick underline</p>밑줄 오프셋
underline-offset-*으로 밑줄을 아래로 조금 이동하세요. 작은 underline-offset-2를 사용하면 g, p, y처럼 아래로 내려오는 부분에 선이 닿는 것보다 훨씬 우아해 보입니다.
<a href="#" class="underline underline-offset-4 decoration-indigo-600 text-indigo-700 font-medium">
A clean, offset underline
</a>텍스트 변환: 대문자와 첫 글자 대문자
변환으로 글자의 대소문자를 시각적으로 바꿀 수 있습니다. 레이블과 버튼에는 uppercase, 소문자에는 lowercase, 제목에는 capitalize, 초기 상태로 되돌릴 때는 normal-case를 사용하세요. HTML을 직접 수정할 필요가 없습니다.
<span class="uppercase text-xs font-semibold tracking-wider text-gray-500">
section label
</span>
<span class="capitalize text-lg font-medium">
each word gets capitalized
</span>
<button class="uppercase text-sm font-bold tracking-wide">
get started
</button>텍스트 넘침: 잘라내기와 생략 부호
truncate로 넘치는 텍스트를 깔끔하게 처리하세요. 한 개의 클래스만으로 넘치는 부분을 숨기고 생략 부호를 추가하며 줄바꿈을 막습니다. 공간이 좁은 한 줄 텍스트에 적합합니다.
<!-- Truncate a long title in a card -->
<div class="w-48">
<p class="truncate text-gray-900 font-medium">
This is a very long title that will be cut off with an ellipsis
</p>
</div>여러 줄 제한
여러 줄의 최대 표시 줄 수를 제한하려면 line-clamp-*를 사용하세요. line-clamp-2는 두 줄을 표시한 뒤 생략 부호를 추가하므로, 카드 설명이나 높이를 맞춘 미리보기에 적합합니다.
<!-- Blog card excerpt: exactly 3 lines -->
<p class="line-clamp-3 text-gray-600 text-sm">
This is a blog post excerpt that could be much longer.
It will be clamped to exactly three lines no matter how
much text is here. The rest is hidden with an ellipsis.
This fourth line will never be visible.
</p>공백 제어
whitespace-* 유틸리티는 공백의 동작을 결정합니다. whitespace-nowrap은 레이블의 줄바꿈을 막고, whitespace-pre는 코드의 공백과 줄바꿈을 유지합니다.
<!-- Keep a button label on one line -->
<button class="whitespace-nowrap px-4 py-2 bg-indigo-600 text-white rounded">
Schedule a Demo
</button>
<!-- Display code with preserved formatting -->
<pre class="whitespace-pre font-mono text-sm bg-gray-100 p-4 rounded">
const x = 1;
const y = 2;
</pre>실습: 글 메타데이터 행
글 메타데이터 행에는 모든 요소가 함께 사용됩니다. 아바타와 작성자, 흐리게 표시한 날짜, 가리켰을 때 링크에 나타나는 밑줄, 그리고 대문자와 넓은 트래킹을 적용한 읽기 시간 배지가 들어갑니다.
<div class="flex items-center gap-3 text-sm text-gray-500">
<img src="avatar.jpg" class="w-8 h-8 rounded-full" alt="" />
<a href="#" class="font-medium text-gray-900 hover:underline">Jane Doe</a>
<span>·</span>
<time class="">June 20, 2024</time>
<span>·</span>
<span class="uppercase tracking-wide font-semibold text-xs text-indigo-600">
5 min read
</span>
</div>빠른 확인
빠르게 확인해 보세요! 정렬과 장식이 어떻게 기억에 남았는지 살펴보세요. ✍️
레슨 요약
잘하셨습니다! text-left/center/right는 정렬을 지정하고, underline과 line-through는 장식을 적용하며, uppercase와 line-clamp는 텍스트의 형태를 조정합니다. 다음에는 색상 팔레트와 배경을 알아봅니다.
AI 튜터와 함께 HTML을(를) 배우세요 — 무료
브라우저에서 실제 코드를 작성하고 실행하며, 24/7 AI 튜터로부터 즉각적인 도움을 받고, 웹이나 앱에서 중단한 부분부터 계속 학습하세요.
- 코스
- 30
- 레슨
- 120
자주 묻는 질문
“텍스트 정렬과 장식” 강의는 무료인가요?
네 — “텍스트 정렬과 장식” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Tailwind CSS Academy 강의 전체를 잠금 해제할 수 있습니다. Tailwind CSS Academy 강의에는 총 4개의 강의가 포함되어 있습니다.
“텍스트 정렬과 장식”에서 뭘 배우나요?
text-left, text-center, text-right로 텍스트를 정렬하고 밑줄, 취소선, 대문자 변환과 같은 변형을 추가합니다. 브라우저에서 직접 실행하는 실습 코드로 Tailwind CSS Academy을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
Tailwind CSS Academy을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 Tailwind CSS Academy은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 4번째 강의입니다.
“텍스트 정렬과 장식” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 Tailwind CSS Academy 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 Tailwind CSS Academy 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- 글꼴 크기와 글꼴 굵기
- 텍스트 색상과 불투명도
- 줄 높이와 자간
- 텍스트 정렬과 장식