[HTML&CSS] Position , Pseudo selectors - 1
( UPDATE 2023 - 05 - 26 )
Position
Position ์ ๋ํดํธ๋ static
position : fixed;
์คํฌ๋กค์ ์ฌ๋ฆฌ๋ ๋ด๋ฆฌ๋ ์ด๊ธฐ์ ์ธํ ํ ๊ทธ ์์น์ ๊ณ ์ ๋จ.
์๋จ ๋ฉ๋ด ๋ฐ ๋ฑ์ ๊ณ ์ ํ ๋ ๋ง์ด ์.
position : fixed; (์ฃผ์์ )
top, bottom, left, right ์ค ํ๋๋ผ๋ ์์ ํ๋ฉด,
๋ณ๊ฐ์ ๋ ์ด์ด์ฒ๋ผ ๊ฒน์ณ์ง ๋, fixed๋ฅผ ์ ์ผ ์์๋ก ํ๊ณ ๊ฒน์ณ์ง
posititon : relative;
์์น ์กฐ๊ธ ์ฎ๊ธฐ๊ณ ์ถ์ ๋ ์ฌ์ฉ.
์ฒ์ ์์นํ ๊ณณ์ ๊ธฐ์ค์ผ๋ก ์ํ์ข์ฐ๋ก ์์ ํจ. (๋ถ๋ชจ ์์ ๋ฌด์X)
position : absolute;
์ํ ์ข์ฐ๋ฅผ ์ด๋ ํ๊ณ ์ถ์ ๋ ์ฌ์ฉํจ.
๋ถ๋ชจ(์์) ์์ ๋ฌด์ํ๊ณ ์ด๋ํ๊ฑฐ๋,
posititon : relative; ์์์ ๋ถ๋ชจ๋ฅผ ๊ธฐ์ค์ผ๋ก ์ด๋.
pseudo selector
pseudo selector
์ธ๋ถ์ ์ผ๋ก ์์๋ค์ ์ ํํ๊ฒ ํ๋ ๊ฒ
nth-child
์์) :first-child , :last child, nth-child(2) ๋ฑ
class๋ id๋ฅผ ๋ง๋๋ ๊ฒ๋ณด๋ค ํจ์ฌ ์ข์ ๋ฐฉ๋ฒ
nth-child(even)
์ง์ ๋ณ๋ก ์ ์ฉ
nth-child(odd)
ํ์ ๋ณ๋ก ์ ์ฉ
nth-child(3n+1)
์์ ๊ฐ์ด ๊ดํธ ์์ '์' ์กฐ๊ฑด ๋ง๋ค ์ ์์
์ถ์ฒ
๋ ธ๋ง๋ ์ฝ๋ ์ฝ์ฝ์ํก ํด๋ก ์ฝ๋ฉ