How To Use CSS
You can use CSS(Cascading Style Sheet) in four ways. These are given below: The given above CSS type, in which various technique will be used. These are different from each other and their different advantages.
- Embedded or Internal CSS
- Inline style
- External style sheet
- Imported CSS
Embedded or Internal Style Sheet
An Embedded or Internal Style Sheet is used in only one single page. It is define within <style> element inside the <head> section. Let us see an example of CSS embedded or internal style sheet:Example of Internal Style Sheet
<head>
<style>
body {
background-color: white;
}
p{
color: black;
border:2px solid red;
}
</style>
</head>
Inline Style Sheet
An Inline Style Sheet used with a unique style for a single element. You must have to used style attribute to the element.<p style="text-align:center; color:blue"> We are learning how to use inline Style </p>
External Style Sheet
In External Style Sheet can use <linl> element to include an external stylesheet file. The style file extension must be .css . you can access style sheet in different web pages by using link the style sheet. Let us see an example of CSS external style sheet:<head>
<link type = "text/css" href = "style.css">
</head>
/*========= Save it name with style.css ===========*/
body{
Background-color: gray;
}
h1 {
color: blue;
text-transform: lowercase;
}