CSS: External Styling
Although learning about external style sheets is not on the agenda right now, it's good to understand what it actually does. External style sheets are suitable for a website with many pages. The look of the entire web site can be changed just by modifying one CSS file!
Style details are saved to an external CSS file, and then linked to, from the <head> section of the HTML page.
The HTML document: |
CSS file called styles.css: |
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph</p>
<p>This is another paragraph</p>
</body>
</html>
|
body {
background-color: lightblue;
}
h1 {
color: navy;
margin-left: 20px;
}
p {
color: red;
margin-left: 45px;
font-size: 22px;
}
|