gpt4 book ai didi

HTML 和 CSS 页脚

转载 作者:可可西里 更新时间:2023-11-01 15:00:18 25 4
gpt4 key购买 nike

您好,我对这个网页的页 footer 分有疑问,例如由于某种原因,页脚没有正确排列,我不确定它有什么问题这就是它应该看起来的样子 ( https://imgur.com/Bmvfbrx ) 但这是它的样子 ( https://imgur.com/vY1kPTH )。只是请告诉我我做错了什么,我会感谢你,谢谢。另外我在验证器上也有 0 个错误。

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="cyclestyle.css">
<title>Cycling Tours</title>
</head>
<body>
<div id="container">
<section id="header">
<header>
<nav>
<ul>
<li><a href="aboutus.html">About us</a></li>
<li><a href="a" title="Ask Us">Ask Us</a></li>
<li><a href="a" title="Destination">Destination</a></li>
<li><a href="a" title="FAQ">FAQ</a></li>
<li><a href="a" title="Reviews">Reviews</a></li>
<li><a href="a" title="Seminars">Reviews</a></li>
<li><a href="a" title="Trip Prep">Trip Prep</a></li>
</ul>
</nav>
<h1>Cycling Tours</h1>
<figure>
<img id="banner" src="images/cycling_banner.png" alt="cycling">
</figure>
</header>
</section>
<section id="aboutus">
<h3> About Us </h3>
<p> Cycling Tours began when Bill Randolf and three of his friends from high school began to cycle regularly every weekend. Their routine cycling evolved into frequent cycling trips and they cultivated a following. Before they knew it, other friends and family members asked to join them in their trips.</p>
<img src = "images/cyclists.jpeg" alt="cyclists" class = "floatright">
<p>Cyclists are enthusiastic and very health and environmentally conscious. For this reason, all of our trips include vegan options for meals, recycled paper food serving utensils, and hybrid vehicles to escort the cyclists.</p>
<p>Our trips are suitable for solo cyclists, couples, friends, and families. We provide camping accommodation for off-road cycling trips, and shared accommodations for couples, friends and families. If you are travelling solo, we can match you with someone for shared accommodations. You can also pay the single-supplement if you wish to have a room of your own.</p>
<p>After you've completed one trip with us, we're sure you'll want to do more. Over 80% of our customers have been on at least one prior trip with us. We're always looking for new ideas for trips, so please let us know if you have any ideas!</p>
</section>
<section id="tripinfo">
<h3>Trip Information</h3>
<br>
<p>Our trips are planned carefully to provide the best experience for cyclists.</p>
<br>
<p>Types of trips include self-contained camping tours, inn-to-inn tours and other adventure cycling.</p>
</section>
<footer>
<div id = "footer">
<hr>
<hr>
<p>Cycling Tours&#10043 P.O. Box 4455&#10043 Brantford,ON&#10043 N3T 2J0 <br> Image Credit: http://www.bikelink.com/images/banner01.jpg </p>
</div>
</footer>
</div>
</body>

</html>

cyclestyle.css

        * { 
margin: 0;
padding: 0;
}

body {
height:90vh;
}

p {
text-indent: 50px;
line-height:1.5em;
}

#tripinfo {
background-color:#bbccdd;
float:right;
width:20%;
height:68.5vh;
}

header {


}

#banner {
width:100%;

}

nav {
list-style-type: none;
text-align: center;
text-decoration: none;
}

nav li {
display: inline ;

}




#container {
width: 1000px;
margin: 20px auto;
}

* {
box-sizing: border-box;
}

nav a{
border: 2px solid black;
padding: 8px;
border-radius:10px 10px 0px 10px;
text-decoration:none;
background-color:#bbccdd;
color:white;
font-family: verdana;
font-weight:bold;
}
a:hover {
color: black;
}


#aboutus {
float:left;
width:80%;
height:80vh;
}
h1 {
position:absolute;
font-family:Verdana;
color:White;
font-size:3.5em;
}
h3 {
font-family:Verdana;
}

p {
font-family:Verdana;
font-size:.90em;
}

#footer {
text-align:centre;
font-weight:bold;

}

#container {
width: 1000px;

}

最佳答案

你快到了。使用 float 时需要记住。总是创建另一个使用 CSS clear:both 的 div,它会将下一个 div 推到底部。

HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="cyclestyle.css">
<title>Cycling Tours</title>
</head>
<body>
<div id="container">
<section id="header">
<header>
<nav>
<ul>
<li><a href="aboutus.html">About us</a></li>
<li><a href="a" title="Ask Us">Ask Us</a></li>
<li><a href="a" title="Destination">Destination</a></li>
<li><a href="a" title="FAQ">FAQ</a></li>
<li><a href="a" title="Reviews">Reviews</a></li>
<li><a href="a" title="Seminars">Reviews</a></li>
<li><a href="a" title="Trip Prep">Trip Prep</a></li>
</ul>
</nav>
<h1>Cycling Tours</h1>
<figure>
<img id="banner" src="images/cycling_banner.png" alt="cycling">
</figure>
</header>
</section>
<section id="aboutus">
<h3> About Us </h3>
<p> Cycling Tours began when Bill Randolf and three of his friends from high school began to cycle regularly every weekend. Their routine cycling evolved into frequent cycling trips and they cultivated a following. Before they knew it, other friends and family members asked to join them in their trips.</p>
<img src = "images/cyclists.jpeg" alt="cyclists" class = "floatright">
<p>Cyclists are enthusiastic and very health and environmentally conscious. For this reason, all of our trips include vegan options for meals, recycled paper food serving utensils, and hybrid vehicles to escort the cyclists.</p>
<p>Our trips are suitable for solo cyclists, couples, friends, and families. We provide camping accommodation for off-road cycling trips, and shared accommodations for couples, friends and families. If you are travelling solo, we can match you with someone for shared accommodations. You can also pay the single-supplement if you wish to have a room of your own.</p>
<p>After you've completed one trip with us, we're sure you'll want to do more. Over 80% of our customers have been on at least one prior trip with us. We're always looking for new ideas for trips, so please let us know if you have any ideas!</p>
</section>
<section id="tripinfo">
<h3>Trip Information</h3>
<br>
<p>Our trips are planned carefully to provide the best experience for cyclists.</p>
<br>
<p>Types of trips include self-contained camping tours, inn-to-inn tours and other adventure cycling.</p>
</section>
<div class="clearfix"></div>
<footer>
<div id = "footer">
<hr>
<hr>
<p>Cycling Tours&#10043 P.O. Box 4455&#10043 Brantford,ON&#10043 N3T 2J0 <br> Image Credit: http://www.bikelink.com/images/banner01.jpg </p>
</div>
</footer>
</div>
</body>

</html>

CSS

* { 
margin: 0;
padding: 0;
}

body {
height:90vh;
}

p {
text-indent: 50px;
line-height:1.5em;
}

#tripinfo {
background-color:#bbccdd;
float:right;
width:20%;
height:68.5vh;
}

header {


}

#banner {
width:100%;

}

nav {
list-style-type: none;
text-align: center;
text-decoration: none;
}

nav li {
display: inline ;

}




#container {
width: 1000px;
margin: 20px auto;
}

* {
box-sizing: border-box;
}

nav a{
border: 2px solid black;
padding: 8px;
border-radius:10px 10px 0px 10px;
text-decoration:none;
background-color:#bbccdd;
color:white;
font-family: verdana;
font-weight:bold;
}
a:hover {
color: black;
}


#aboutus {
float:left;
width:80%;
/* height:80vh; */ /* I remove this line */
}
h1 {
position:absolute;
font-family:Verdana;
color:White;
font-size:3.5em;
}
h3 {
font-family:Verdana;
}

p {
font-family:Verdana;
font-size:.90em;
}

.clearfix {
clear:both;
}

#footer {
text-align:center;
font-weight:bold;

}

#footer p {
padding-top:10px;
}

#container {
width: 1000px;

}

DEMO

关于HTML 和 CSS 页脚,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53165132/

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