CSS saves a lot of work. It can control the layout of multiple web pages all at once.
CSS describes how HTML elements are to be displayed on screen, paper, or in other media. CSS can be added to HTML elements in 3 ways:
Inline - by using the style attribute in HTML elements
Internal - by using a <style> element in the <head> section
External - by using an external CSS file
INSTRUCTION
1. By using Notepad, type the following text:
Example 1
<!DOCTYPE html>
<html>
<head>
<style>
body {background-color: powderblue;} h1 {color: blue;}
p {color: red;}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Example 2
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
QUESTIONS
Explain about the HTML code above.
What is the difference between Example 1 and Example 2?
ANSWERS
1. under <style> css is put.CSS is used to set the background colour and the color of text. h1 is used for the text “This is heading” and set to blue color (color:blue;). p is used for the text “This is a paragraph” and set to red color (color:red;)
2. The difference between Example 1 and Example 2 are the background color of example 1 is blue while example 2 is white. The color of text also set up the texts are set to red and blue.