๋ฐ˜์‘ํ˜•

Tailwind CSS 2.2 ๋ฒ„์ „๋ถ€ํ„ฐ peer-* variants๋กœ ํ˜•์ œ ์š”์†Œ๋ฅผ ์„ ํƒํ•  ์ˆ˜ ์žˆ๋‹ค. input ์š”์†Œ์— peer ํด๋ž˜์Šค๋ฅผ ์ •์˜ํ•ด๋‘๋ฉด, ํ˜•์ œ ์š”์†Œ์—์„œ peer ํด๋ž˜์Šค๋ฅผ ์ด์šฉํ•ด input ์š”์†Œ๋ฅผ ์„ ํƒํ•  ์ˆ˜ ์žˆ๋‹ค. ์ฃผ๋กœ peer-checked ์ฒ˜๋Ÿผ ์š”์†Œ์˜ ํŠน์ • ์ƒํƒœ๋ฅผ ์„ ํƒํ•  ๋•Œ ์‚ฌ์šฉํ•œ๋‹ค. peer-checked๋Š” (์ฒดํฌ๋ฐ•์Šค ๋“ฑ)์š”์†Œ๊ฐ€ ์ฒดํฌ๋œ ์ƒํƒœ์ผ ๋•Œ ์ ์šฉ๋œ๋‹ค. ์ด์™ธ์—๋„ ๋‹ค์–‘ํ•œ ๊ฐ€์ƒ ํด๋ž˜์Šค ์…€๋ ‰ํ„ฐ๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค. e.g. peer-hover peer-focus peer-disabled

<label>
  <input type="checkbox" class="peer sr-only" />
  <!-- input ์š”์†Œ(peer)๊ฐ€ ์ฒดํฌ๋œ ์ƒํƒœ๋ฉด span ์š”์†Œ์˜ ๋ฐฐ๊ฒฝ์ƒ‰์„ blue-500์œผ๋กœ ๋ณ€๊ฒฝ -->
  <span class="h-4 w-4 bg-gray-200 peer-checked:bg-blue-500" />
  <!-- ... -->
</label>

 

์ฐธ๊ณ ๋กœ ์œ„ peer-checked ํด๋ž˜์Šค๋Š” ~ ํ˜•์ œ ์…€๋ ‰ํ„ฐ๋ฅผ ์‚ฌ์šฉํ•œ CSS ์ฝ”๋“œ๋กœ ๋ณ€ํ™˜๋œ๋‹ค.

.peer:checked ~ .peer-checked\:bg-blue-500 {
  background-color: #3b82f6;
}

 

๐Ÿ’ก ~ ํ˜•์ œ ์…€๋ ‰ํ„ฐ๋Š” ์ธ์ ‘ํ•œ(๊ฐ™์€ ๋ ˆ๋ฒจ) ํ˜•์ œ ์—˜๋ฆฌ๋จผํŠธ๋ฅผ ๋ชจ๋‘ ์„ ํƒํ•œ๋‹ค.
e.g. section ~ p { }section ์š”์†Œ ๋’ค์— ์ธ์ ‘ํ•œ ํ˜•์ œ ์—˜๋ฆฌ๋จผํŠธ p ๋ชจ๋‘ ์„ ํƒ

 

๋ ˆํผ๋Ÿฐ์Šค


 

Tailwind CSS v2.2 - Tailwind CSS

An all-new high-performance CLI tool, ::before and ::after support, sibling selectors, selected text variants, and tons more.

tailwindcss.com

 


๊ธ€ ์ˆ˜์ •์‚ฌํ•ญ์€ ๋…ธ์…˜ ํŽ˜์ด์ง€์— ๊ฐ€์žฅ ๋น ๋ฅด๊ฒŒ ๋ฐ˜์˜๋ฉ๋‹ˆ๋‹ค. ๋งํฌ๋ฅผ ์ฐธ๊ณ ํ•ด ์ฃผ์„ธ์š”
๋ฐ˜์‘ํ˜•