Repeat background image in CSS

Repeat background image [background-repeat]

In the example above, did you notice that by default the butterfly was repeated both horizontally and vertically to cover the entire screen? The property background-repeat controls this behaviour.

The table below outlines the four different values for background-repeat.
ValueDescriptionExample
background-repeat: repeat-xThe image is repeated horizontallyShow example
background-repeat: repeat-yThe image is repeated verticallyShow example
background-repeat: repeatThe image is repeated both horizontally and verticallyShow example
background-repeat: no-repeatThe image is not repeatedShow example
For example, to avoid repetition of a background image the code should look like this:

 
 body {
  background-color: #FFCC66;
  background-image: url("butterfly.gif");
  background-repeat: no-repeat;
 }

 h1 {
  color: #990000;
  background-color: #FC9804;
 }
 
 

Comments

Popular posts from this blog

Displaying a flash message after redirect in Codeigniter

What is required for it startup company ?

how to export html data to pdf in angularjs and javascript