CSS 선택자

hanahana·2022년 7월 29일
post-thumbnail

SELECTOR

  • 요소선택자

태그 선택자라고 한다.

 h1{color:yellow}
 h2{color:yellow}
 h3{color:yellow}
 h4{color:yellow}
 h5{color:yellow}
 h6{color:yellow}

이 태그는 h1~h6태그의 색을 yellow로 하겠다는 뜻이다 이것은 그룹화 하여 표기할수 있다.

Grouping

  • 선택자
h1,h2,h3,h4,h5,h6{color:yellow;}

쉼표로 선택하고자 하는 태그를 그룹할수 있다

  • 전체 선택자
* {color:yellow}

*은 모든 태그에 적용한다는 뜻이다

  • 선언
h1{color:yellow; font-size:2em; background-color:gray;}

선언들을 그룹화 할때는 세미클론; 을 사용한다 여러가지 선언을 h1태그에만 적용하는 선언이다

  • 선택자&선언
h1,h2,h3,h4,h5,h6{color:yellow; font-size:2em; background-color:gray;}

선택자와 선언을 동시에 그룹화 할수 있다

선택자는 쉼표,로 구분하고 {}안에 세미클론;으로 선언들을 구문하면 h1~h6를 사용하는 요소들을 선언내용대로 변경할수 있다.

실행결과 :
https://hana78786.github.io/Study_hana/bostcourse_htmlcss/4-2.html
https://hana78786.github.io/Study_hana/bostcourse_htmlcss/4-3.html
https://hana78786.github.io/Study_hana/bostcourse_htmlcss/4-5.html

profile
hello world

0개의 댓글