如何使我的网页在任何大小的任何浏览器窗口中完全显示 [英] How to make my web page display in full in any browser window of any size

查看:124
本文介绍了如何使我的网页在任何大小的任何浏览器窗口中完全显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经建立了网页,这是主要区域的代码。

I have made a webpage and this is the code to the main div.

#Div {
    margin-left: 0px;
    position:absolute;
    margin-top: -1px;
    display: inline;
    float: left;
    margin-bottom: 0;
    background-color: #030;
    width: 660px;
    margin-left:-330px;
    left:50%;
    padding-top: 0px;
    height: 440px;
}

有没有css技术,我可以用来确保页面占据整个

Is there a css technique i can use to make sure the page occupies the whole page no matter the size of the computer screen the browser is on.

推荐答案

为什么要设置 -left 两次?为什么你浮动(并显示内联)一个div,你想要占据整个屏幕?设置负左边距会将整个div向左移动,因此即使当 width:100%时,它也不会到达所有的方向。

Why are you setting margin-left twice? Why are you floating (and displaying inline) a div that you want to take up the whole screen? Setting a negative left margin will move your whole div to the left, and therefore cause it to not reach all the way to the right even when the width: 100%.

取走所有边距。 Do width:100%。更改 display:inline display:block 。拿走浮子。如果您已将 position:absolute 设置为 ,请务必指定: top:0px; left:0px

Take away all margins. Do width:100%. change display:inline to display:block. Take away the float. If you have to set this to position:absolute, then be sure to specify: top: 0px; left: 0px

这篇关于如何使我的网页在任何大小的任何浏览器窗口中完全显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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