Setting up Background Color using CSS

CSSWeb DevelopmentFront End Technology

To set background color using CSS, use the background-color property.

Example

Let us now see an example −

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
.demo {
   text-decoration: overline underline;
   background-color: red;
}
</style>
</head>
<body>
<h1>Details</h1>
<p class="demo">Examination Center near ABC College.</p>
<p class="demo2">Exam begins at 9AM.</p>
</body>
</html>

Output

Example

Let us now see another example −

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
.demo {
   text-decoration: overline underline;
}
</style>
</head>
<body style="background-color: orange;color: white;">
<h1>Details</h1>
<p class="demo">Examination Center near ABC College.</p>
<p class="demo2">Exam begins at 9AM.</p>
</body>
</html>

Output

raja
Published on 30-Dec-2019 12:48:18
Advertisements