What is CSS? How to use it?

What is CSS? How to use it

Cascading Style Sheets (CSS) is a language that shows how a document can be displayed or straightforward to control the style of the document. But if we want to create a good quality website, then CSS is needed. Cascading Style Sheets How to show different elements of an HTML file, such as color, font size, margin, padding, etc. are defined by CSS.

There are three ways to add CSS to HTML:

  1. External style sheet
  2. Internal style sheet
  3. Inline style …

1.External style sheet
An external style sheet is used to add the same style to more than one HTML file. All the websites we visit, all created with the External style sheet. With the help of External style sheet, the style or style of all the web pages at the same time. Which reduces many jobs. By creating a CSS file, all the styles are written in that CSS file. Then it was added to the HTML file.
To add the external style sheet to HTML file, the head tag is written as follows.

<head>
  <linkrel="stylesheet"type="text/css"href="style.css">
</head
Create a file. Name the style.css and save the code below and save it.
.div {
 background: url(../img/ima01.jpgno-repeatcentercenterfixed;
}
#container{
 width:960px;
 margin:70auto;
 padding:40px;
 background:#০০০;
 opacity:.5;
}
h1{
 color:#০০০;
 text-align:center;
}
2.Internal Style Sheet
Internal Style Sheet is used to give style to a specific HTML file. If you use the Internal Style Sheet, you will have to enter the CSS code separately for all the web pages. Internal Style Sheet and Web page / HTML page head tag to be written in. For this, the CSS code is written in another tag named ‘style’ in the head tag. Internal Style Sheet is written in an HTML file as follows.
<head>
 <style>
   .div {background:#cccccc;}
   h1 {color:#c2c2c2;}
 </style>
</head>
3.Inline Styles
Inline Styles is used to giving a specific element style to HTML. Although it is not a good way to style HTML files. Inline Styles inside an HTML tag are written as below
<h4style="color:red; font-size:25px">This is a heading.</h4>
<p style="color:green; font-size:14px">This is a paragraph.</p>
<h6style="color:black; font-size:18px">This is a sub heading.</h6

Facebook Comments