IT Study/Web

[HTML] CSS 적용방법 3가지

도뿌리 2018. 8. 6. 12:37

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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
body{
    background-color: Lightgray;
}
h1{
    color: blue;
    font-family: verdana;
    font-size: 300%
}
</style>
<link rel="stylesheet" href="my.css">    <!-- css파일 가져오기 -->
</head>
 
<body>
 
<!-- inline(태그안) > internal(head) > external(외부(css)파일) -->
 
 
<h1 style="color: yellow;">노란색 h1 태그</h1
 
<h1>여기가 h1 태그입니다.</h1>
 
<p>여기가 p태그 입니다.</p>
</body>
</html>
cs


CSS(my.css)

1
2
3
4
5
6
7
8
@charset "UTF-8";
p{
    border: 1px solid red;
    color: green;
    padding: 10px;
    margin: 15px;
}
cs