gpt4 book ai didi

html - 页脚不显示在页面底部

转载 作者:行者123 更新时间:2023-11-28 02:48:23 24 4
gpt4 key购买 nike

我是编码和构建 html 页面的新手,但我的页脚不会底部,下面是我的代码。我猜我的页脚 CSS 有一些问题,任何人都可以纠正它或指导我如何将页脚保持在网页底部。页脚应该在底部而不是固定的但是如果我的页面中有很多内容页脚应该放在底部。

HTML代码:

<html>
<head>
<title>Ka</title>
<link rel="stylesheet" href="css/style.css">
</head>

<body>


<header>
<nav>
<h1> Ka </h1>
<ul id="nav">
<li><a class="homered" href="#">Heading</a></li>
<li><a class="homeblack" href="#">heading1</a></li>
<li><a class="homeblack" href="#">heading1</a></li>
<li><a class="homeblack" href="#">heading1</a></li>
<li><a class="homeblack" href="#">heading1</a></li>
<li><a class="homeblack" href="#">heading1 </a></li>
</ul>
</nav>
<a href="kaindex.html" ><span class="langsel" style="color: white">others</span> </a>
</header>


<div class="divider"></div>
<div class="slideshow-container">

<div class="mySlides fade">
<img src="images/1.jpg" height="60%" width="100%">
</div>

<div class="mySlides fade">
<img src="images/2.jpg" height="60%" width="100%">
</div>

<div class="mySlides fade">
<img src="images/3.jpg" height="60%" width="100%">
</div>

<div class="mySlides fade">
<img src="images/4.jpg" height="60%" width="100%">
</div>

<div class="mySlides fade">
<img src="images/5.jpg" height="60%" width="100%">
</div>

<a class="prev" onclick="plusSlides(-1)">&#10094;</a>
<a class="next" onclick="plusSlides(1)">&#10095;</a>

</div>
<br>

<div style="text-align:center">

<span class="dot" onclick="currentSlide(1)"></span>
<span class="dot" onclick="currentSlide(2)"></span>
<span class="dot" onclick="currentSlide(3)"></span>
<span class="dot" onclick="currentSlide(4)"></span>
<span class="dot" onclick="currentSlide(5)"></span>
</div>


<div class="page-wrap">

<div class="boxed">
<h2>Ka:</h2>
<p> Kaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa. </p>
</div>


<div class="boxed">
<h2>Ka:</h2>

<p> kaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa. </p>
</div>

<div class="boxed">
<h2>ka:</h2>

<p> kaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa. </p>
</div>

<div class="boxed">
<h2>ma:</h2>

<p> maaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa </p>
</div>

<div class="boxed">
<h2>la:</h2>

<p> Laaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa. </p>
</div>

<div class="boxed">
<h2>ca:</h2>

<p> caaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa. </p>
</div>


<div class="boxed">
<h2>Ca:</h2>

<p> caaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa. </p>
</div>

</div>


<footer class="site-footer">
<p style="copyright">Copyright &copy; aaa </p>


</footer>





<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

<script src="js/home.js"></script>

</body>

</html>

CSS 代码:

html, body{
margin: 0;
padding:0;
height: 100%;
}

header{
background: blue;
color: white;
padding: 8px 0px 6px 40px;
height: 50px;
}

header h1 {
display: inline;
font-family: 'Oswald',sans-serif;
font-weight: 400;
font-size: 32px;
float: left;
margin-top: 0px;
margin-right: 10px;
}

nav ul{
display: inline;
padding: 0px;
float: left;
}

nav ul li{
display: inline-block;
list-style-type:none;
color: white;
float: left;
margin-left: 15px;
}

nav ul li a{
color: white;
text-decoration: none;
}
#nav {
font-family: 'Montserrat', sans-serif;

}

.homered{
background-color: yellow;
padding: 30px 10px 25px 10px;

}

.langsel{

float: right;

}


.divider{
background-color: red;
height: 5px;

}

.homeblack:hover{
background-color: black;
padding: 30px 10px 25px 10px;
}

.mySlides {display:none}

/* Slideshow container */
.slideshow-container {
max-width: 1000px;
position: relative;
margin: auto;
}

/* Next & previous buttons */
.prev, .next {
cursor: pointer;
position: absolute;
top: 50%;
width: auto;
padding: 16px;
margin-top: -22px;
color: white;
font-weight: bold;
font-size: 18px;
transition: 0.6s ease;
border-radius: 0 3px 3px 0;
}

/* Position the "next button" to the right */
.next {
right: 0;
border-radius: 3px 0 0 3px;
}

/* On hover, add a black background color with a little bit see-through */
.prev:hover, .next:hover {
background-color: rgba(0,0,0,0.8);
}


/* The dots/bullets/indicators */
.dot {
cursor:pointer;
height: 13px;
width: 13px;
margin: 0 2px;
background-color: #bbb;
border-radius: 50%;
display: inline-block;
transition: background-color 0.6s ease;
}

.active, .dot:hover {
background-color: #717171;
}

/* Fading animation */
.fade {
-webkit-animation-name: fade;
-webkit-animation-duration: 1.5s;
animation-name: fade;
animation-duration: 1.5s;
}

@-webkit-keyframes fade {
from {opacity: .4}
to {opacity: 1}
}

@keyframes fade {
from {opacity: .4}
to {opacity: 1}
}

/* On smaller screens, decrease text size */
@media only screen and (max-width: 300px) {
.prev, .next {font-size: 11px}
}


.boxed {
float: left ;
border: 5px solid green ;
border-radius: 10px ;
height: 100px;
width: 400px;
padding: 10px;
margin: 30px;

}

.site-footer{
position:absolute;
width:100%;
height:30px; /* Height of the footer */
background:green;
font-weight: bold;
color: white;
font-size:20px;
text-align: center;
font-family: 'Montserrat', sans-serif;
left:0;
bottom:0;
right:0;
margin-bottom: 0px;

}


#rowDiv{
margin:auto;
text-align: center;
width: 100%;
}
input[type="text"]{
height:40px;
font-size:20px;

}
#submitWeather{
height:40px;
font-size:20px;
font-weight: bold;
}

#show{
margin: auto;
width: 60%;
}


#errorCity{
width: 50%;
font-size: 25px;
text-align: center;
margin: auto;

}

最佳答案

使position:relative;或者删除它

.site-footer {
clear: both;
position: relative;
width: 100%;
height: 30px;
background: green;
font-weight: bold;
color: white;
font-size: 20px;
text-align: center;
font-family: 'Montserrat', sans-serif;
left: 0;
bottom: 0;
right: 0;
margin-bottom: 0px;
}

并添加

<div style="clear:both;">
</div>

上一节盒装课后

关于html - 页脚不显示在页面底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46794573/

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