There are three ways of inserting a style sheet:
- External style sheet
- Internal style sheet
- Inline style
External Style Sheet
With the external style sheet, you can change the look of an whole website by changing just one file!
Each page must include a reference to the external style sheet file inside the <link> element. The <link> element goes inside the <head> section:
<head>
<link rel="stylesheet" type="text/css" href="index.css">
</head>
The external style sheet can be written in any text editor.File should not contain any html tags and file must be saved with a .css extension.
Example of a style sheet file called "index.css", is given below:
body {
background-color: gray;
}
p {
color: red;
text-align: center;
background-color: gray;
}
p {
color: red;
text-align: center;
font-size: 18px;
}
}