100%自举高度div 3 [英] 100% height div with bootstrap 3

查看:81
本文介绍了100%自举高度div 3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作一个完整高度的网站,但它似乎叽叽喳喳与身体最小高度问题100%

I want to make a full height website but it seem twitter make issue with body min-height 100%

这里我的CSS:

html{
    height:100%;
}
body{
    min-height:100%
}
#main{
    min-height:100%;
}

这里是我的HTML:

<html>
    <head>
        ...
    </head>
    <body>
        <div id="main" class="container">
            ...
        </div>
    </body>
</html>

如果内容比浏览器小,但我希望我的#main div始终与浏览器的高度相同如果我的内容更大,div会比浏览器更高。

I want my #main div always same height that browser if content is smaller than browser but I want my div will highter than browser if my content is bigger.

使用我的代码,#main div总是能够获得我内容的高度,并且不会根据我的浏览器大小调整有一个小内容。

With my code, #main div always take height of my content and don't adjust to my browser size if i have a small content.

为什么?!

推荐答案

在CSS下面,你将完成:

Just add below CSS and you will be done :

body, html {
  padding:0px;
  margin:0px;
  height: 100%;
  min-height: 100%;
}

这篇关于100%自举高度div 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆