Menu
CoddyTech

여러 줄 미리 보기

Coddy Tailwind CSS 여정의 반응형 UI 패턴 섹션에 포함된 레슨. 55개 중 33번째.

카드 설명에는 한 줄로 잘린 레이블 대신 몇 줄이 필요할 수 있습니다. line-clamp-2는 텍스트 블록을 두 줄까지만 표시하고 나머지는 잘라 내면서 문서에는 전체 텍스트를 남겨 둡니다. 이 예시에서는 미리 보기 옆에 전체 설명으로 이동하는 링크를 제공합니다.

<article><p class="line-clamp-2 leading-6">A longer event description appears here.</p><a href="#details">Read the full description</a></article>

미리 보기의 역할에 따라 줄 수를 선택하세요. line-clamp-3은 세 줄을 허용하고, line-clamp-none은 줄 제한을 없애 일반적인 오버플로를 복원합니다. 반응형 변형을 사용하면 공간이 더 넉넉할 때 좁은 화면의 미리 보기 제한을 없앨 수 있습니다.

클램핑은 요약을 위한 것이지, 필수 지침이나 오류를 숨기기 위한 것이 아닙니다. 전체 콘텐츠에 접근할 수 있도록 유지하세요. 줄 높이를 알고 있으면 한 줄당 특정 글자 수를 가정하지 않아도 예상되는 미리 보기 높이를 쉽게 확인할 수 있습니다.

challenge icon

챌린지

중급

제공된 설명 미리보기의 기존 24px 줄 높이는 유지하면서 세 줄로 제한하세요. 전체 텍스트와 전체 설명 링크는 그대로 유지하세요. 미리보기는 카드가 확장되지 않고 넘치는 내용을 잘라내야 합니다.

제공된 콘텐츠, 시맨틱 요소 및 ID를 그대로 유지하세요. 요청된 유틸리티 클래스를 수정하세요. 수정한 후 ‘미리보기 실행’을 누른 다음, 결과를 채점하려면 ‘확인’/‘코드 실행’을 누르세요. 제공된 JavaScript는 읽기 전용입니다.

작동하는 전체 설명 링크와 줄 제한이 적용되지 않은 전체 텍스트의 대상이 계속 제공되도록 하세요.

직접 해보기

<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Interface workshop</title><link rel="stylesheet" href="./styles.css"></head><body>
<article class="w-48"><p id="summary" class="leading-6 ">A hands-on workshop explores drawing, printing, color mixing, composition and collaborative studio practice. Bring a notebook and discover several approaches with the teaching team. A hands-on workshop explores drawing, printing, color mixing, composition and collaborative studio practice. Bring a notebook and discover several approaches with the teaching team. A hands-on workshop explores drawing, printing, color mixing, composition and collaborative studio practice. Bring a notebook and discover several approaches with the teaching team. </p><a href="#full">Read full description</a></article>
<section id="full" tabindex="-1" class="mt-8"><h2>Full workshop description</h2><p id="fullText">A hands-on workshop explores drawing, printing, color mixing, composition and collaborative studio practice. Bring a notebook and discover several approaches with the teaching team. A hands-on workshop explores drawing, printing, color mixing, composition and collaborative studio practice. Bring a notebook and discover several approaches with the teaching team. A hands-on workshop explores drawing, printing, color mixing, composition and collaborative studio practice. Bring a notebook and discover several approaches with the teaching team. </p></section></body></html>
quiz icon실력 점검

이 레슨에는 짧은 퀴즈가 포함되어 있습니다. 레슨을 시작해 문제를 풀고 진행 상황을 기록하세요.

반응형 UI 패턴의 모든 레슨