Background CSS Properties and Example

Background Image CSS Properties and Example

The CSS Background Image Properties is used to change the background Image of elements. The elements can be -
ü  html
ü  body
ü  footer
ü  H1,H2 and so on
ü  div
ü  P
ü  Your custom elements and so on

This property is supported most of browsers like IE, chrome, safari etc.
/* For HTML background image*/
html
    background-image: url("background.gif");
}

/* For HTML body background image*/
body {  
    background-image: url("background.gif");
    background-repeat: repeat-x;
}

/* For HTML body footer image*/
footer
    background-image:url("background.gif");
}


/* For HTML H1 tag background color*/
h1 {
    background: green;
}

/* For HTML div background image*/
div {
    background-image:url("background.gif");
}

/* For HTML page P background color*/
p {
    background: yellow;
}

/* For HTML div class selector background color*/
.MyPage-class { background: white; }

/* For HTML div ids selector background image*/
#MyPage-Ids {
    background-image:url("background.gif");
}


I hope you are enjoying with this post! Please share with you friends. Thank you!!
ANIL SINGH

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..
My Blogs - https://code-sample.com and https://code-sample.xyz
My Book1 - BEST SELLING ANGULAR BOOK (INCLUDING ALL VERSIONS 2, 4, 5, 6, 7)
My Book2 - ANGULAR 2 INTERVIEW QUESTIONS BOOK - Both Books are Available on WorldWide.

www.code-sample.com/. Powered by Blogger.
^