Make body have 100% of the browser height

后端 未结 21 1734
离开以前
离开以前 2020-11-22 00:26

I want to make body have 100% of the browser height. Can I do that using CSS?

I tried setting height: 100%, but it doesn\'t work.

I want to set

21条回答
  •  半阙折子戏
    2020-11-22 00:43

    all answers are 100% correct and well explained, but i did something good and very simple to make it responsive.

    here the element will take 100% height of view port but when it comes to mobile view it don't look good specially on portrait view ( mobile ), so when view port is getting smaller the element will collapse and overlap on each other. so to make it little responsive here is code. hope someone will get help from this.

    
    
    

    here is JSfiddle Demo.

提交回复
热议问题