You are on page 1of 32

1

2


3
4
Selector { property:value;…. }

body {background: #FFF; color: #FF0000;font-size: 14pt;}


.class {font-size: 10pt; font-weight: bold; }
#id {text-transform:uppercase; font-style: italic; }
5

6


7

<tag style= “property1: value1;


…property N:value N;”>…
</tag>

Ví dụ:
<H1 STYLE="color: yellow">This is yellow </H1>

8
<head>
<style type=“text/css” >
<!–
SelectorName{
property 1:value1;
property 2:value2;
………
property N: valueN;
}
…-->
</style>
</head> 9
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: #000;
}

h1 {
color: red;
margin-left: 40px;
}
</style>
</head>
<body>

<h1>This is a heading</h1>
<p>This is a paragraph.</p>

</body>
</html>
10
11

<head>
<link rel=“stylesheet” href=“URL” type="text/css">
</head>

12
13

body {
background-color: lightblue;
}

h1 {
color: navy;
margin-left: 20px;
}
14

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
<body>

<h1>This is a heading</h1>
<p>This is a paragraph.</p>

</body>
</html>

15
16




17

.TieuDe1 {
color: red;
font-family: Verdana, sans-serif;
}

<h1 class=“TieuDe1”> ĐHCNTT</h1>

18
https://www.w3schools.com/css/css_selectors.asp
19
<!DOCTYPE html>
<html>
<head>
<style>
p {
text-align: center;
color: red;
}
</style>
</head>
<body>
<p>Tất cả các đoạn văn bản sẽ bị ảnh hưởng</p>
<p id="para1">Me too!</p>
<p>And me!</p>
</body>
</html>
20
21
22
23
selector { position: giá trị; }

24
25
26
27
28
29
30
31
32

You might also like