How to make a div with 100% height? (passing viewport)

Asked

Viewed 494 times

0

I want to put a background image in this div, I’ve tried with height:100% but the height of the div is limited to the height of the viewport, and when you scroll down, the div ends, and also the background image.

  • 1

    Tried to put a position: fixed?

  • I used it and it worked here.

  • 1

    @Herison if you want to know more about how this property works I advise reading the post on the link below, very interesting, explains what each of the attributes of position makes and its impacts on the layout. Position property of css

  • 1

    Why not put the background in the body?

1 answer

0


Simply add the property position: fixed in his div.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.