Background CSS Properties and Example

Background CSS Properties and Example

The CSS Background Properties is used to change the background 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 color*/
    background: white;

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

/* For HTML body footer*/
    background: black;

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

/* For HTML div background color*/
div {
    background: lightblue;

/* 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 color*/
#MyPage-Ids {
  background: rgba(0, 0, 0, 0.8);

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

Hey! I'm Anil Singh. I author this blog. I'm Active Blogger, Programmer. I love learning new technologies, programming, blogging and participating the forum discussions more...
My Blogs - and
My Books - Interview Questions and Answers Books- Get Your Book in 15+ Digital Stores Worldwide..

You Might Also Like
Post a Comment Powered by Blogger.
ASK Questions