The CSS background properties are used to define the backgrounds affects for element.
- Background-Color
The background-color property specifies the background color of an element.
The background-color property of a page set like this :-
Example
<!DOCTYPE html>
<html>
<head>
<title> CSS Background bg-color </title>
<style>
body
{
background-color: lightblue;
}
</style>
</head>
<body>
<h1>Hello This is kumar Atul jaiswal.</h1>
<p>This is a paragraph.</p>
</body>
</html>
Result
The background-color property of a page set like this :-
Example
<!DOCTYPE html>
<html>
<head>
<title> CSS Background bg-color </title>
<style>
body
{
background-color: lightblue;
}
</style>
</head>
<body>
<h1>Hello This is kumar Atul jaiswal.</h1>
<p>This is a paragraph.</p>
</body>
</html>
Result
With CSS, a color is most often specified by:
a valid color name - like "red"
a HEX value - like "#ff0000"
an RGB value - like "rgb(255,0,0)"
Look at CSS Color Values for a complete list of possible color values.
In the example below, the <h1>, <p>, and <div> elements have different background colors:
Example
<!DOCTYPE html>
<html>
<head>
<title> CSS Background bg-color </title>
<style>
h1 {
background-color: green;
}
div {
background-color: lightblue;
}
p {
background-color: yellow;
}
</style></head>
<body>
<h1>CSS background-color example!</h1>
<div>
This is a text inside a div element.
<p>This paragraph has its own background color.</p>
We are still in the div element.
</div>
</body>
</html>
Result
0 comments:
Post a Comment
For Any Tech Updates, Hacking News, Internet, Computer, Technology and related to IT Field Articles Follow Our Blog.