21/10/2019

Lesson 4

About CSS

CSS

CSS stands for Cascading Style Sheets

CSS describes how HTML elements are to be displayed on screen, paper, or in other media

CSS saves a lot of work. It can control the layout of multiple web pages all at once

External stylesheets are stored in CSS files

EXAMPLE

<p style="font-size:32px; color:red;" >

We had learned above rule.

When we use css, <style> ~ </style> .


  <style type="text/css">
p{
  font-size:32px;
  color:red;
}
</style>

<p style="font-size:32px; color:red;" > and above css is same effect.

Class Selector

Using css, however, all <p> are changed by above rule.

For example,if we want to change sencondly <p>, we should use "Class Selector"

The CSS class Selector

The class selector selects HTML elements with a specific class attribute.

To select elements with a specific class, write a period (.) character, followed by the class name.

EXAMPLE

  <style type="text/css">
p{
  font-size:32px;
}
.red-font{
  color:red;
}

</style>

Nameing rule is anything OK. Simple and Easy to understand is the best.

Like "ohayo" or "sawa-dii-krap" are not recommended and often be used English word.But these are not wrong, just not recommended.

Class Selector can also refer to more than one class.

Let's Try

Adding "class selector" and CSS, then try to design <h1> or <h2> or <p>.

Changing text color line by line.