gpt4 book ai didi

javascript - Bootstrap 3 - 所有页面的固定高度

转载 作者:太空宇宙 更新时间:2023-11-04 12:37:23 26 4
gpt4 key购买 nike

当我加载另一个网页时,div 会变小,页脚会根据 div 中的内容上下移动。

谁能帮我看看为什么会这样。

我的代码(与使用 Flask 略有不同):

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>WBP Assignment</title>
<meta name="keywords" content="UEA, University, Coursework, York, Cottage, WBP, Web, Based, Programming">
<meta name="viewport" content="width=device-width, initial-scale=1.0"><!--mobile first :p -->
<meta name="description" content="UEA Undergraduate coursework assignment">
<meta name="author" content="Matthew Wilson, Pedro Bernardina">

<!--Bootstrap CSS-->
<link href="static/bootstrap.min.css" rel="stylesheet">
<link href="static/style.css" rel="stylesheet">

<!--Bootstrap Core JS-->
<script type="text/javascript" src="static/jquery.min.js"></script>
<script type="text/javascript" src="static/bootstrap.min.js"></script>
<script type="text/javascript" src="static/scripts.js"></script>
</head>

<body background="templates/background.jpg">

<div class="container">
<div class="row clearfix">
<div class="col-md-12 column">
<!-- A carousel inside the jumbotron, sliding data every 3000ms. -->
<div class="carousel slide" id="carousel-274384" data-interval="3000" data-ride="carousel"><!--carousel begin-->
<div class="carousel-inner">

<div class="item active"><!--begin item-->
<img alt="" src="static/img/1.JPG">
</div><!--end item-->

<div class="item"><!--begin item-->
<img alt="" src="static/img/2.JPG">
</div><!--end item-->

<div class="item">
<img alt="" src="static/img/3.JPG">
</div><!--end item-->

<div class="item">
<img alt="" src="static/img/4.JPG">
</div><!--end item-->

<div class="item">
<img alt="" src="static/img/5.JPG">
</div><!--end item-->
</div><!--end carousel inner-->

</div><!--end carouseul-->

<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button> <a class="navbar-brand" href="/">York Cottage</a>
</div>

<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>
<a href="/">Home</a>
</li>
<li>
<a href="/features">Features</a>
</li>
<li>
<a href="/gallery">Gallery</a>
</li>
<li>
<a href="/comments">Comments</a>
</li>
<li>
<a href="/contact">Contact</a>
</li>

</ul>
</div>

</nav>
<div class="row clearfix">
{% block content %}
<div class="content">

<div class="col-md-12 column" >

{% if pageType == "index" %}
<h3> {{ title }} </h3>

{% for p in paragraph %}
<p> {{ p }}</p>
{% endfor %}



<a href="http://www.southern-comfort.co.uk/" class="img-responsive" target="_blank"><img alt="" width="550" src="static/img/comfort.jpeg"></a>

{% endif %}

{% if pageType == "features" %} <!-- if vistor clicks features then index body disappears and features appears -->

<h3> {{ title }} </h3>

<ul>
<li>Living Room: Spacious open plan sitting room. Two sofas, 42" flat screen TV. DVD, Video, CD Player. </li>
<li>Kitchen/ Diner: Well equipped fitted kitchen with washing machine, dishwasher and microwave. Large dinning table with six chairs. </li>
<li>Bedroom 1: Double bed with an en-suite room. Fitted wardrobes.</li>
<li> Bedroom 2: Double bed with fiited wardrobes </li>
<li> Bedroom 3: Two twin beds with a fitted wardrobe</li>
<li> Bedroom 4: Single bed with two large fitted wardrobes</li>
<li> Upstairs Bathroom: Upstairs bathroom with bath</li>
<li> Downstairs Bathroom: Bathroom with power shower</li>
<li> Patio picnic bench overlooking heated swimming pool. Large front garden with driveway for three cars. </li>
</ul>
{% endif %}


</div>
{% endblock %}
</div>
</div>

<div class="col-md-1 column">
</div><!--right margin-->


<div class="row clearfix">

<div class="col-md-1 column">
</div><!--left margin-->

<div class="col-md-12 column" id="footer"><!--footer-->
<p>Matthew Wilson
<br/>Pedro Bernardina
<br/>Norwich Research Park, NR4 7TJ
<br/>University of East Anglia
<br/>All Rights Reserved
</p>
</div>

<div class="col-md-1 column">
</div><!--right margin-->

</div>

</div>
</div>
</div>
</body>
</html>

CSS:

.carousel-inner{
width:100%;
max-height: 28em !important;
}

.navbar-default {
background-color: #FFFFFF;


}


div#jumbotron {
margin-top: 2em;
}

div#map_canvas {
height:45em;
background-color: black;
}

div#main_cmt {
overflow: scroll;
background-color: white;
height: 50em;
margin-top: 2em;

}

ul#navbar {
background-color:white;
}

div#content {
background-color: white;
height: 50em;
margin-top: 2em;
}

div#extra {
background-color: white;
height: 50em;
margin-top: 2em;
text-align: justify;
}

div#footer {
background-color: #484848;
color: white;
padding: 1em;
margin-top: 2cm;
}



body {
background: url("..\FlaskApp\FlaskApp\templates\background.jpg");
}
/* resizes images in the website when screen is smaller */

img {
display: block;
height: auto;
max-width: 100%;
}


/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}

/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
/* Styles */
}

/* Smartphones (portrait) ----------- */
@media only screen
and (max-width : 320px) {
/* Styles */
}

/* iPads (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) {
/* Styles */
}

/* iPads (landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape) {
/* Styles */
}

/* iPads (portrait) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) {
/* Styles */
}

/* Desktops and laptops ----------- */
@media only screen
and (min-width : 1224px) {
/* Styles */
}

/* Large screens ----------- */
@media only screen
and (min-width : 1824px) {
/* Styles */
}

/* iPhone 4 ----------- */
@media
only screen and (-webkit-min-device-pixel-ratio : 1.5),
only screen and (min-device-pixel-ratio : 1.5) {
/* Styles */
}

最佳答案

这是因为 div 容器没有固定的高度。如果你想让它成为一个固定的高度,只需将它添加到你的文件中

HTML:

改变这个

<div class="container">

<div class="container fixed-height">

CSS:

将此添加到 css 文件

div.fixed-height {
height: 900px !important;
}

您可以将高度更改为任何您想要的高度。如果您只是想将页脚保持在页面底部,我也不建议这样做。如果您浏览互联网,还有其他方法可以做到这一点。

关于javascript - Bootstrap 3 - 所有页面的固定高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27183497/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com