You Can Become A
๋ฆ๊ฒ ์์ํด๋ ๋๊ตฌ๋ ์ง ๋ ธ๋ ฅํ๋ฉด ๊ฐ๋ฐ์๊ฐ ๋ ์ ์์ด์ !
last-child
๐ first-child / first-of-type ์์ฑ ์ฐจ์ด์
first-child ์ first-of-type ์ฐจ์ด์ first-child ์ first-of-type์ ๋๊ฐ์ด ์์ ํ์ ์์ ๊ณ ๋ฅด๋๊ฒ๊ฐ์๋ฐ ๋ฌด์์ด ๋ค๋ฅผ๊น? ํ๋ฐฉ์ ์ดํดํ๊ธฐ ์ฝ๊ฒ ๊ฐ๋จ๋ช ๋ฃํ๊ฒ ์ค๋ช ํ๋ฉด ์ด๋ ๋ค. div > p:first-child 'div ํ์์ p ์์ ์ค ์ฒซ๋ฒ์งธ ์์' ๋ก ์ฝ๋ ๊ฒ ์๋๋ผ 'div ํ์์ ์ฒซ๋ฒ์งธ ์์์ธ ์์๊ฐ p ์์' ์ด๋ฉด์ด๋ค. ์ฆ, div์ ์์ ์์์ค์ first-child๋ฅผ ๊ณ ๋ฅด๋๋ฐ ๊ทธ๊ฒ p์ด๋ฉด ์คํ์ผ์ ์ ์ฉํ๋ค. ๋ง์ผ p๊ฐ ์๋ค๋ฉด ์คํ์ผ์ ์ ์ฉํ์ง ์๋๋ค. 'div first-child is p' ๋ผ๊ณ ์์ด ๋ฌธ์ฅ์ผ๋ก ์ดํดํ๋ฉด ๋๋ค. .parent > span:first-child { background: lightgreen; } .parent2 > p:fi..