External Style Sheet
This will be very useful when we have so many styles defined.
We will want to take all the styles in to a different file.
That's what we do in External CSS. We take all the styles in a external file and map it with the html page.
Example:
We will put the following style in a text file say style.css
Example:
We will put the following style in a text file say style.css
<style>
.style1
{
color: green;
background-color: orange;
}
</style>
In our head we will link to the external style sheet using the tag link in header portionTag:
<head>
<link rel="stylesheet" type="text/css" href="style.css"/>
</head>
The names used for user defined styles should not belong to any html tag.
We set the style for the tag using the attribute "class".
Example1:
<font class=style1>home </font>
Result1:
Example2:
<a href="home.php" class=style1> home </a>
Result2: