0% found this document useful (0 votes)
4 views

How To Write CSS

Uploaded by

Simo Renato
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

How To Write CSS

Uploaded by

Simo Renato
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

How to write CSS

In this unit, you will learn the basic grammar of CSS.


While learning the basic grammar, let's set CSS in the HTML of the site
and arrange the layout.

There were three ways to style HTML with CSS.

Inline style

Inline style is a way to write a style directly on a tag.


Set the style attribute on the tag and describe the set of properties and
values in it.

(example)

1 <p style="color: red">Title</p>

This is an easy method to use, but the more styles you want to set, the
longer the description will be.

(example)

1 <p style="color: red; font-size: 20px; background-color: silver;">Title</p>

Describe in <style>

This method uses the <style> tag of HTML and describes CSS within it.

(example)

<!DOCTYPE html>
1
<html lang="ja">
2
<head>
3
<meta charset="utf-8">
4
<title>DIC cafe</title>
5
<!-- Install style tag -->
6
<style>
7
h1 {
8
color: red;
9
}
10
</style>
11
</head>
12
<body>
13
<h1 class="title">Title</h1>
14
<p>Contents</p>
15
</body>
16
</html>
17

You might also like