最小高度不与身体工作 [英] min-height does not work with body

查看:101
本文介绍了最小高度不与身体工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

min-height不适用于body / html吗?

Does min-height not work on body/html?

body, html
{
    min-height:100%;
}

完全没有任何东西(firebug报告身体,html标签高度不会改变所有)

Accomplishes absolutely nothing (firebug reports the body,html tags height does not change at all)

推荐答案

首先,声明一个doctype,使你达到标准,如果你还没有。

First, declare a doctype so you're in standards if you haven't already.

现在,body只能和包含html一样高,因此您需要将HTML标记设置为100%高度,将body设置为min-height 100%。

Now, the body can only be as high as the containing html, so you need to set HTML tag to 100% height, and body to min-height 100%. This works for me on Firefox.

html {height:100%} 
body {min-height:100%}

这篇关于最小高度不与身体工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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