使div适合初始屏幕 [英] Making a div fit the initial screen

查看:103
本文介绍了使div适合初始屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让一个div适合用户屏幕的初始高度和宽度。

I want to make a div fit the initial height and width of a users screen.

我认为下面粗略绘制的图解释这更好:

I think the following crudely drawn diagram explain this better:

>

#div
{
 width: 100%;
 height: 100%;
}

似乎不起作用

推荐答案

如果我理解正确(这里有一些混乱的空间):

If I understand correctly (there's some room for confusion here):

a href =http://jsfiddle.net/zRpNp/> http://jsfiddle.net/zRpNp/

http://jsfiddle.net/zRpNp/

#screenFiller {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    border: 15px solid orange
}

c $ c> position:fixed 版本: http://jsfiddle.net/zRpNp/1/

You might be after the position: fixed version: http://jsfiddle.net/zRpNp/1/

这篇关于使div适合初始屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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