CSS 스타일 시트를 작성하는 방법 3가지 

1. <style></style> 태그에 스타일 시트 작성
2. style 속성에 스타일 시트 작성
3. 스타일 시트를 별도 파일로 작성하고, <link>태그나 @import로 불러 사용


<style> 태그의 특징
<style> 태그는 반드시 <head> 태그 내에서만 작성 가능하다.
- <style> 태그는 여러 번 작성 가능하며 스타일 시트들이 합쳐 적용된다.
- <style> 태그에 작성된 스타일 시트는 웹 페이지 전체에서 적용된다.

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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>&lt;style&gt; 태그로 스타일 만들기</title>
<style>
body {
    background-color : linen;
    color : blueviolet;
    margin-left : 30px;
    margin-right : 30px;
 }
h3 {
    text-align : center;
    color : darkred;
}
</style>
</head>
<body>
<h3>소연재</h3>
<hr>
<p>저는 체조 선수 소연재입니다. 음악을 들으면서
책읽기를 좋아합니다. 김치 찌개와 막국수 무척
좋아합니다.</p>
</body>
</html>
 
cs






 

Posted by 너래쟁이
: