Ways to Insert CSS
There are Three Ways to Insert CSS :
There are three methods for placing a method sheet:
- External style sheet
- Internal style sheet
- Inline style
External Style :
An external type sheet is perfect once the type is put on several pages. Having an outside type sheet, you can modify the look of a whole Web site by adjusting one file. Each site must connect to the type sheet using the command. The command moves inside the head section:
An additional type sheet can be written in just about any text editor. The record should not contain any html tags. Your type sheet must certanly be saved with a .css extension. An example of a style sheet record is revealed below:
hr {color:sienna;}
p {margin-left:20px;}
body {background-image:url(“images/back40.gif”);}
p {margin-left:20px;}
body {background-image:url(“images/back40.gif”);}
Internal Style :
An inner design sheet must be used each time a simple record features a distinctive style. You establish inner variations in the top element of an HTML site,
Inline Style :
An inline model loses many of the advantages of model sheets by pairing content with presentation. Use this method modestly!
To use inline styles you utilize the model feature in the relevant tag. The model feature can contain any CSS property. The example shows how to improve along with and the left profit of a sentence:
To use inline styles you utilize the model feature in the relevant tag. The model feature can contain any CSS property. The example shows how to improve along with and the left profit of a sentence:
Multiple Style :
If some properties have been collection for the same selector in different model sheets, the values will soon be learned from the more particular model sheet.
As an example, an external model page has these properties for the h3 selector:
As an example, an external model page has these properties for the h3 selector:
h3
{
color:blue;
text-align:left;
font-size:8pt;
}
{
color:blue;
text-align:left;
font-size:8pt;
}
And an inside style sheet has these attributes for the h3 selector:
h3
{
text-align:right;
font-size:20pt;
}
{
text-align:right;
font-size:20pt;
}
If the site with the internal style sheet also links to the external model sheet the homes for h3 is likely to be:
color:red;
text-align:right;
font-size:20pt;
text-align:right;
font-size:20pt;
Along with is learned from the external style sheet and the text-alignment and the font-size is replaced by the inside style sheet.