CSSの書き方
htmlファイル
——————————————————————
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ホームページのタイトル</title>
<link rel="stylesheet"type="text/css"href="style.css"
</head>
<body>
<h1>ホームページの見出し</h1>
<p>青い文字になるよ</p>
<p>ここも青い文字になるよ</p>
</body>
</html>
——————————————————————
——————————————————————
p{
color: blue;
font-size : 20px ;
}
——————————————————————
上記例で言うと
- セレクタ:p要素に対して
- プロパティ名:文字色を、文字サイズを
- 値:青色に、20pxに
- 指定して適用
改行は無視されるので見やすい形で書いてOK
—————————————————————
p{color: blue; font-size : 20px ;}
↓
p{
color: blue;
font-size : 20px ;
}
——————————————————————