如何获得人体元素的全宽 [英] How to get full width in body element
本文介绍了如何获得人体元素的全宽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何才能使网站自动适合该页面?
How would I be able to get a website to auto-fit in the page?
这是不需要滚动的景观设计.
It's a landscape design which needs no scrolling.
推荐答案
您应将 body
和 html
设置为 right:
, 顶部:
和 底部:
改为 0;
.这样,即使内容溢出,它也不会超出视口的限制.
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.
例如:
<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屋!
查看全文