In this tutorial we will give you complete information about CSS Background Property. You will know what CSS Background Property is? How to set CSS Background?
CSS Background Property is used to set the background in Webpages. CSS also provides many additional background properties to control the background.
Define is usually done in the Background Body Element. Which apply on our entire webpage. If you want, you can also set the background for a particular element.
You can set any type of background as per your choice. You can set the Color Background if you want. Or you can also set Image Background. These two are being mentioned below.
Setting Background Color
If you want to set a color background for your HTML document, then the background-color property of CSS is used. And Color is defined in its value.
You can define Color Value in any way. If you want, define the Color Name, or write the Hex Value of Color, or you can also set it in RGB Value. You can read CSS Color Tutorial for more information about this. Where we have explained about CSS Color in detail.
<!DOCTYPE html>
<html>
<head>
<title>CSS Color Background</title><style>p {
background-color: orange;
}
</style>
</head>
<body>
<h1>
This is Heading.
</h1>
<p>
This is Paragraph. You Can Write Your Content Here.
</p>
</body>
</html>
The above code will give you these results. We have set the background color here only for the Paragraph Element.
Setting Background Image
You can also make a Particular Image a background like a Color Background.
CSS uses background-image property to set the image background. And the Image URL is defined in its value.
<!DOCTYPE html>
<html>
<head>
<title>CSS Image Background</title><style>body {
background-image: url("expertstool-logo.png");
}
</style>
</head>
<body>
<h1>This is Image Background.</h1>
<p>This paragraph text has an image behing it.</p>
</body>
</html>