twitter-bootstrap Bootstrap 3 中的容器,完美适应观众屏幕尺寸的高度

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18789821/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 18:22:52  来源:igfitidea点击:

Container in Bootstrap 3 that perfectly adapts to the HEIGHT of the viewers' screen size

twitter-bootstrapresponsive-designcontainerstwitter-bootstrap-3

提问by ??????

Here is the problem.

这是问题所在。

I use bootstrap 3.0for a very, very basic website. Still, I would like to add some refinement but I need help.

bootstrap 3.0用于一个非常非常基本的网站。不过,我想添加一些改进,但我需要帮助。

The structure of the website is very basic: a containerand several jumbotronsinside the container.

网站的结构非常基本:一个container和几个jumbotrons在容器内。

I would like to have EACH Jumbotron to perfectly stretch to the height of the user's browser window, so that whatever the media may be (smartphone, web, etc) a visitor will see ENTIRELY and ONLYone jumbotron at the time without the need of scrolling down with the mouse...

我希望每个 Jumbotron 都能完美地延伸到用户浏览器窗口的高度,这样无论媒体是什么(智能手机、网络等),访问者在不需要滚动的情况下都可以同时看到整个 Jumbotron 并且只看到一个用鼠标下来...

Do you have an idea? Many thanks!! ;)

你有想法吗?非常感谢!!;)

回答by Zim

You could add a specialCSS class to the container and set it to 100% height. The HTML and BODY must also be 100% height...

您可以special向容器添加一个CSS 类并将其设置为 100% 高度。HTML 和 BODY 也必须是 100% 的高度...

html,body {height:100%;}
.special,.special .jumbotron {height:100%;}

Demo: http://bootply.com/80826

演示:http: //bootply.com/80826

This however does not address the issue of seeing only 1 jumbotron at a time.. which is more of a navigation issue than a size issue. You may want to use a carousel for the jumbotrons if you don't want the user to scroll down at all.

然而,这并没有解决一次只能看到 1 个超大屏幕的问题……这更像是一个导航问题而不是尺寸问题。如果您根本不希望用户向下滚动,您可能希望为超大屏幕使用轮播。

回答by Ken Prince

I believe what you want is actually stacking, full-screen, responsive backgrounds, or stacking divs that conform to the height of the window / viewport.

我相信你想要的其实是堆叠、全屏、响应式背景,或者堆叠符合窗口/视口高度的div。

That's been answered over here:

这已经在这里得到了回答:

Full-screen responsive background image

全屏响应式背景图片