Html background-size

1763 views html5
0

I have background image size 1920x200. In my browser i have different scale, so the width of my image in browser is more than 1920. To see the entire image i have to change the scale to 75%. But i am trying to make a size of my background image no bigger and no less than browser box with different scales. My code looks like

<nav class="navbar navbarlogo">
<div class="container">
    <div class="col-6">
        <h4> Sample text 1</h4>
        <h5> Sample text 2</h5>
    </div>
</div>

.navbarlogo {
    height: 200px;
    background: url("../img/html-page-background-color-with-29-web-pics-s-at.png") no-repeat;
    background-size:cover;

This code doesn't work exactly how i want. What's wrong?

answered question

1 Answer

9

How about closing the navbar?

<nav class="navbar navbarlogo"></nav>

and use

background-size:contain;

posted this

Have an answer?

JD

Please login first before posting an answer.