15. TAG 선택
CSS 에서 또는 자바스크립트에서 선택을 위한 방법
TAG class=“class_1” /
TAG id=“id_1” /
TAG
16. TAG 선택
TAG
!DOCTYPE html
html
head
style
p {
text-align: center;
color: red;
}
/style
/head
body
pEvery paragraph will be affected by the style./p
p id=para1Me too!/p
pAnd me!/p
/body
/html
17. #ID 선택
!DOCTYPE html
html
head
style
#para1 {
text-align: center;
color: red;
}
/style
/head
body
p id=para1Hello World!/p
pThis paragraph is not affected by the style./p
/body
/html
TAG id=“id_1” /
18. .CLASS 선택 1
!DOCTYPE html
html
head
style
.center {
text-align: center;
color: red;
}
/style
/head
body
h1 class=centerRed and center-aligned heading/h1
p class=centerRed and center-aligned paragraph./p
/body
/html
TAG class=“class_1” /
19. .CLASS 선택 2
!DOCTYPE html
html
head
style
p.center {
text-align: center;
color: red;
}
/style
/head
body
h1 class=centerThis heading will not be affected/h1
p class=centerThis paragraph will be red and center-aligned./p
/body
/html
TAG class=“class_1” /
TAG 와 class 가 모두 만족하는 조건으로 찾기
20. 태그 여러개 선택
!DOCTYPE html
html
head
style
h1, h2, p {
text-align: center;
color: red;
}
/style
/head
body
h1Hello World!/h1
h2Smaller heading!/h2
pThis is a paragraph./p
/body
/html
TAG_A /
TAG_B /
TAG_C /