Background size property

 <!DOCTYPE html>

<html>

    <head>

        <title>Page Title</title>

        <style>

            div.first{

    height:150px;

    width:200px;

    border:1px solid black;

    background: url("https://www.linkpicture.com/q/0_15.png") no-repeat 50% 50%;

    background-size:100px 100px;

    background-color:pink;

}

div.second{

    height:150px;

    width:200px;

    border:1px solid black;

    background: url("https://www.linkpicture.com/q/0_15.png") no-repeat 50% 50%;

    background-size: contain;

    background-color:pink;

}

div.third{

    height:150px;

    width:200px;

    border:1px solid black;

    background: url("https://www.linkpicture.com/q/0_15.png") no-repeat 50% 50%;

    background-size: cover;

    background-color:pink;

}


        </style>

    </head>

    <body>

        <div class="first">normal</div>

        <div class="second">contain</div>

        <div class="third">cover</div>

    </body>

</html>


OUTPUT




Comments