background-size

The background-size CSS property specifies the size of the background images. The size of the image can be fully constrained or only partially in order to preserve its intrinsic ratio.

Syntax

background-size: 50%
background-size: 3em
background-size: 12px
background-size: auto

<!DOCTYPE HTML>
<html>
    <head>
        <title>CSS Tutorials</title>
        <style>
            .bar {
                width: 50px;
                height: 100px;
                background-image: url(myimage.png);
                background-size: 25px 50px;
                background-size: 50% 50%;
            }
        </style>
    </head>
    <body>
        <div class="exampleone">
            first Div
        </div>
        <div class="exampletwo">
            Second Div
        </div>
        <div class="examplethree">
            THird Div
        </div>
    </body>
</html>