Internal CSS
- The internal style sheet is used to add a unique style for a single document. It is defined in <head> section of the HTML page inside the <style> tag.
Syntax:
<style>
Selectors {
property : value;
}
</style>
For example:
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: linen;
}
h1 {
color: red;
}
</style>
</head>
<body>
<h1>The internal style sheet is applied on this heading.</h1>
</body>
</html>
Advantages of Internal CSS:
- You can use class and ID selectors in this style sheet.
- Since you’ll only add the code within the same HTML file, you don’t need to upload multiple files.