클래스리스 버전 (Class-less version)
미니멀리즘을 즐기고 싶다면 Pico의 .classless 버전이 딱이에요. 클래스를 거의 쓰지 않고 시맨틱한 HTML만으로 꾸미고 싶은 분들을 위한 옵션이랍니다.
이 버전에서는 <body> 안의 <header>, <main>, <footer>가 컨테이너 역할을 해서 가운데 정렬 또는 유동 뷰포트를 정의해요.
/* Containers */
body > header,
body > main,
body > footer {
...
}
이 두 페이지는 같은 스타일을 가져요.
<!-- With pico.min.css -->
<body>
<main class="container">
<h1>Hello, world!</h1>
</main>
</body>
<!-- With pico.classless.min.css -->
<body>
<main>
<h1>Hello, world!</h1>
</main>
</body>
버전 선택기를 참고하면 프로젝트에 맞는 Pico CSS 버전 변형을 쉽게 고를 수 있어요.
출처: 문서
본문
사용법 (Usage)
가운데 정렬 뷰포트가 필요하다면 기본 .classless 버전을 사용하세요.
<link rel="stylesheet" href="css/pico.classless.min.css">
유동 컨테이너가 필요하다면 .fluid.classless 버전을 사용하세요.
<link rel="stylesheet" href="css/pico.fluid.classless.min.css">
이 .classless 버전들은 jsDelivr CDN에서도 사용할 수 있어요.
<!-- Centered viewport -->
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.classless.min.css"
>
<!-- Fluid viewport -->
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.fluid.classless.min.css"
>
루트 컨테이너 (Root container)
<header>, <main>, <footer>에 적용되는 기본 루트 컨테이너를 커스터마이징해야 한다면, 다른 CSS 선택자로 Pico를 다시 컴파일할 수 있어요.
React, Gatsby, Next.js 같은 환경에서 특히 유용해요.
/* Custom Class-less version for React */
@use "pico" with (
// Define the root element used to target <header>, <main>, <footer>
// with $enable-semantic-container and $enable-responsive-spacings
$semantic-root-element: "#root",
// Enable <header>, <main>, <footer> inside $semantic-root-element as containers
$enable-semantic-container: true,
// Enable .classes
$enable-classes: false
)
위 코드는 다음과 같은 방식으로 컨테이너를 정의해 Pico를 컴파일해요.
/* Containers */
#root > header,
#root > main,
#root > footer {
...
}
SASS로 Pico 커스텀 버전 컴파일하기에 대해 자세히 알아보세요.