Ways to Include CSS
There are three main methods to apply the defined CSS code to an HTML document.
1. Using External CSS
This method involves creating a separate file for CSS code and linking that file to the HTML document.
<head> <link rel="stylesheet" type="text/css" href="styles.css" /> </head>
Write your style code in a separate file named styles.css
and link it to the HTML document using the <link>
tag.
2. Using Internal CSS
You can define styles using a <style>
tag within the <head>
section of the HTML document.
The CSS defined this way only applies to the specific HTML document.
<head> <style> body { background-color: lightblue; } </style> </head>
3. Using Inline CSS
This method applies styles directly to HTML elements.
The defined style only applies to the specified element.
<p style="color:red;">This sentence is displayed in red.</p>
Which method to choose depends on various factors such as project requirements and ease of maintenance.
Follow the highlighted parts in the code to input them yourself.
What is the most appropriate option to fill in the blank?
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help