View video tutorial

CSS Background Size

CSS

This property specifies the size of a background image.

CSS background-position property

The background-position property sets the size of the background image.

Example

body {
  background-image: url('resources/images/mountain.png');
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
Try it Now »

Click on the "Try it Now" button to see how it works.


Sample Code

Copy each file contents and paste it to your own project and run to see the final output

Example

body {
  background-image: url('resources/images/mountain.png');
  background-repeat: no-repeat;
  background-size: 75% 50%;
}
Try it Now »

Click on the "Try it Now" button to see how it works.