[英]How to make Bootstrap container auto for height?
I am a newbie for JS/CSS and also Bootstrap. 我是JS / CSS和Bootstrap的新手。 And I got a problem for the Bootstrap's height. 而且我对Bootstrap的高度有疑问。 In general, when the content is too much, the different parts overlay. 通常,当内容太多时,不同的部分会重叠。
My webpage is based on the Cover template ( https://github.com/twbs/bootstrap/tree/master/docs/examples/cover ) of Bootstrap. 我的网页基于Bootstrap的Cover模板( https://github.com/twbs/bootstrap/tree/master/docs/examples/cover )。 When I added many content in the <div class="inner cover"></div>
block of https://github.com/twbs/bootstrap/blob/master/docs/examples/cover/index.html The layout becomes horrible and chaotic: 当我在https://github.com/twbs/bootstrap/blob/master/docs/examples/cover/index.html的<div class="inner cover"></div>
块中添加许多内容时可怕而混乱:
While the correct layout is: https://getbootstrap.com/examples/cover/ 正确的布局是: https : //getbootstrap.com/examples/cover/
How can I make the container height auto, so that the height is adjusted according to the content length? 如何使容器高度自动设置,以便根据内容长度调整高度? Thanks for your attention and help! 感谢您的关注和帮助!
Look into this css : 看看这个CSS:
<!-- Custom styles for this template -->
<link href="cover.css" rel="stylesheet">
In this .css you have this part : 在此.css中,您具有以下内容:
/*
* Affix and center
*/
@media (min-width: 768px) {
/* Pull out the header and footer */
.masthead {
position: fixed;
top: 0;
}
.mastfoot {
position: fixed;
bottom: 0;
}
/* Start the vertical centering */
.site-wrapper-inner {
vertical-align: middle;
}
/* Handle the widths */
.masthead,
.mastfoot,
.cover-container {
width: 100%; /* Must be percentage or pixels for horizontal alignment */
}
}
@media (min-width: 992px) {
.masthead,
.mastfoot,
.cover-container {
width: 700px;
}
So, for me, the problem is your custom cover stylesheet isn't in the right place. 因此,对我来说,问题在于您的自定义封面样式表放置在不合适的位置。 Hopes this help you. 希望这对您有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.