如何让页面自动适应窗口? [英] How do I get a page to auto fit to a window?
问题描述
我刚刚为一位朋友开始了我的第一个正确的HTML网站,我想知道如何才能让网站自动创建页面?
这是一个不需要滚动的景观设计。 应该将 body
和 html
设置为 position:fixed;
,然后设置 right:
, left:
, top:
和 bottom:
至 0;
。这样,即使内容溢出,它也不会超出视口范围。
例如:
< HTML>
< body>
< div id =wrapper>< / div>
< / body>
< / html>
CSS:
html,body,{
position:fixed;
top:0;
bottom:0;
剩下:0;
right:0;
}
警告:使用此方法,如果用户缩小窗口大小,内容将被剪切关闭。
I've just started my first proper HTML website for a friend, and I was wondering how I would be able to get the website to autofit the page?
It's a landscape design which needs no scrolling.
You should set body
and html
to position:fixed;
, and then set right:
, left:
, top:
, and bottom:
to 0;
. That way, even if content overflows it will not extend past the limits of the viewport.
For example:
<html>
<body>
<div id="wrapper"></div>
</body>
</html>
CSS:
html, body, {
position:fixed;
top:0;
bottom:0;
left:0;
right:0;
}
Caveat: Using this method, if the user makes their window smaller, content will be cut off.
这篇关于如何让页面自动适应窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!