Use app×
QUIZARD
QUIZARD
JEE MAIN 2026 Crash Course
NEET 2026 Crash Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
75 views
in Information Technology by (46.8k points)
closed by

Explain ‘background-color’ property in css.

1 Answer

+1 vote
by (50.2k points)
selected by
 
Best answer

The background-color property describes the background color of browser window.

To change the background color of an entire page, the background-color property should be applied to the <body> tag. You can also apply background colors to other elements including headlines and text.

Example, apply different background colors to <body> and <h1> tags.

Code to be inserted in font.html :

<html >
<head>
<title>Example </title>
<link rel=”stylesheet” href=”ex1.css” type=”text/css” media=”all” />
</head>
<body>
<h1> Example displaying foreground and background colour.</h1>
</body>
</html>

Code to be inserted in ex1.css :

body {
 background-color: #FFCC60;
}
h1 {
 color: #990011;
 background-color: #FC9004;
}

Note : that two properties have been applied to <h1> by dividing them by a semicolon.

Code produced by the following above code :

output of background color property

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...