개발자의 길/Web Programming
<CSS> CSS 선언 및 적용
모쿠
2017. 3. 30. 10:54
<CSS(Cascading Style Sheet)>
* CSS를 적용하는 방법
1. Inline Style: HTML 태그 안에서 style 속성을 설정
2. Internal Style: <head> 태그 안에서 <style> 요소들을 정의
3. External Style: 외부 CSS 파일을 링크해서 사용(CSS파일을 생성해서 불러옴)
<01_css.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 30 31 32 33 | <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>CSS</title> <style> .div1 { color: red; font-size: 200%; } </style> <!-- 외부 CSS 파일을 링크 --> <link rel="stylesheet" type="text/css" href="css/mystyle1.css"> </head> <body> <h1>CSS(Cascading Style Sheet)</h1> <div >Inline Style</div> <div style="color: blue; font-size: 150%;">Inline Style</div> <div class="div1">Internal Style</div> <div class="div2">External Style</div> </body> </html> | cs |
<mystyle1.css>
1 2 3 4 5 | @CHARSET "UTF-8"; .div2 { color: green; font-size: 300%; } | cs |
<출력화면>