:before, :after 선택자
:before 요소의 시작지점 선택
:after 요소의 끝지점 선택
html)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, height=device-height, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0"> <title>Insert title here</title> <style type="text/css"> /* :before 요소의 시작지점 선택 */ h1:before { content: "Before"; font-size: 1.5em; color: #FF0000; } /* :after 요소의 끝지점 선택 */ h1:after { content: "After"; font-size: 1.5em; color: #0000FF; } </style> </head> <body> <h1>가나다라마바사아자차카타파하</h1> </body> </html> | cs |
결과
h1요소 내용의 앞 뒤로 Before와 After가 추가되었다
'IT > - 프로그래밍' 카테고리의 다른 글
HTML5/CSS3 @font-face : 폰트파일 사용하기 (0) | 2017.05.30 |
---|---|
HTML5/CSS3 :first-letter, :first-line 선택자 (0) | 2017.05.29 |
HTML5/CSS3 속성관련 선택자 (0) | 2017.05.27 |
HTML5/CSS3 인접 형제 선택자, 형제 선택자 (0) | 2017.05.26 |
HTML5/CSS3 :root 선택자 : body태그 보다 위의 최상위 선택자 (0) | 2017.05.25 |