CSS Backgrounds

In this tutorial you will learn about the CSS Backgrounds and its application with practical example.

CSS Background of an element is the rendering surface of the HTML Element’s, it could be either a color or an image. A background refers to the background of the content, padding and border areas.

Table Of Contents

Common CSS Background Properties

Property Description Example
background-color It specifies the background color of an element. background-color: red;
background-image It specifies background image of an element background-image: url (“img1.png”);
background-repeat It Specifies background image repeatition vertically or horizontally or both. background-image:url(img1.gif);background-repeat: repeat;

background-image:url(img1.gif);
background-repeat: repeat-y;

background-image:url(img1.gif);
background-repeat: repeat-x;

background-position It specifies the position of a background image background-image:url(img1.gif);
background-position:100px 200px;
background-attachment It specifies the scrolling of an image in the background. background-image:url(img1.gif);
background-attachment:scroll;
background It is short hand notation that allows to define all background properties. background: url(“img1.png”) gray 50% repeat fixed

In this tutorial we have learn about the CSS Backgrounds and its application with practical example. I hope you will like this tutorial.