In HTML page designing we often see various type of background of content, wondering how that works!
Let’s learn setting up background using CSS
Background using CSS Style
When we say setting background, it can be back ground of any type of HTML document.
So here we create a class with some background, and the class can be applied on any element
Now in following example we have written some text (“Using Background Image”) in a <div> and the <div> has some background image.
Using Background Image
Here is the class we have written.
.bgExample
{
background-image:url('../images/learn-css.png');
background-position:center;
min-height:120px;
border:solid 1px #0094ff;
text-align:center;
font-size:28px;
color:#ffd800;
}
Now you can enhance it further with many other background-image properties
CSS properties of background |
background-repeat |
Often used options are : repeat-x | repeat-y | no-repeat | ...many more |
background-color |
you can set any color using CSS |