CSS 선택자

Yonnie·2024년 2월 7일

html

목록 보기
2/6

css diner css 선택자 사이트

  1. 태그이름

  2. .class

  3. #id

  4. "*"

  5. " "
    ex) div p {}
    ex) .test p{}
    : .test 안에 있는 p 태그 선택

  6. "+"
    ex) .test+p{}
    : .test 바로 뒤에 오는 p 태그 선택

  7. ">"
    ex) .test>p{}
    : .test 직계 자식에만 있는 첫번째만 선택

  8. "~"
    ex) .test~p{}
    :+보다 관대함 바로 뒤 말고 어쨋든 뒤에 있으면 선택

  9. "[]"
    ex) a[title] : title속성을 가진 a 태그 선택
    ex) a[title="naver] : title속성을 가진 a 태그 선택

  10. ":" 가상 클래스

    a:hover, link, visited
    p:not(.class)
    p:nth-child(n) :nth-of-type(n)

  11. "::" 가상 요소
    p::first-line, first-letter
    ::after, before
    content: " " //필수요소

profile
프론트엔드 개발을 해보자~

0개의 댓글