html - 如何使用相同的 css 表锁定多个页面的页脚高度
问题描述
我的索引表页脚部分的高度合适,但每当我将第二个可点击页面链接到样式表或第二个页面时。页脚部分被拉长了,我怎样才能使页脚之后的每一页都具有相同的高度。
我希望页脚在从菜单栏创建的多个页面上保持不变,就像大多数网站上的页脚一样。有没有办法正确地做到这一点?HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>All Products - Only Leaf | Store</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="css/bootstrap.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
</head>
<body>
</----Page information---->
<!-----------------------------footer------------------------------------->
<div class="footer">
<div class="container">
<div class="row">
<div class="footer-col-1">
<h3>Follow Us on our Social Media Page.</h3>
<p>Follow us to stay up to date on products and giveaways</p>
</div>
<div class="footer-col-2">
<img src="Images/instagram.jpg">
<p>Follow us on Instagram to see the Latest with Only Leaf.</p>
</div>
<div class="footer-col-3">
<h3>Useful Links</h3>
<ul>
<li>Coupons</li>
<li>Blog with Station 33</li>
<li>Return Policy</li>
<li>Join Affiliates</li>
</ul>
</div>
<div class="footer-col-4">
<h3>Useful Links</h3>
<ul>
<li>Twitter</li>
<li>Facebook</li>
<li>Instagram</li>
<li>Station 33</li>
</ul>
</div>
</div>
<hr>
<p class="copyright">Copyright 2021 - theElement</p>
</div>
</div>
CSS
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
html body{
font-family: 'Poppins', sans-serif;
height: 100%;
}
a{
text-decoration: none;
color: #555;
}
p{
color: #555;
}
.header{
background: radial-gradient(#fff,#ffd6d6);
}
.collapse ul {
background-color: #ff523b;
}
.container{
max-width: 1300px;
margin: auto;
padding-left: 25px;
padding-right: 25px;
}
.navbar{
width: 100%;
height: 80px;
min-height: 22px;
margin-right: 45px;
}
.navbar-custom{
background-color: #ff523b;
}
.navbar-custom .nav-link:hover{
color: black;
}
.navbar.navbar-inverse {
border: none;
}
.navbar .navbar-custom .navbar-brand img {
height: 85px;
padding-left: 39%;
}
.navbar-light .navbar-nav .nav-link {
color: #ff523b;
}
.custom-toggler .navbar-toggler{
border-color: #000;
}
.navbar ul.navbar-nav li.nav-item a.nav-link {
color: #fff;
padding-right: 25px;
margin-right: 25px;
}
#navbarMenu{
align-items: flex-end;
padding-right: 5%;
}
@media (max-width: 768px) {
nav.navbar .navbar ul.navbar-nav li.nav-item a.nav-link {
background-color: lightgray;
}
}
/*----.
.navbarMenu{
padding: 75px;
}
nav{
flex: 1;
text-align: right;
}
nav ul{
display: inline-block;
list-style-type: none;
}
nav ul li{
display: inline-block;
margin-right: 20px;
}---*/
.menu-icon{
display: none;
width: 28px;
margin-left: 20px;
}
.row{
display: flex;
align-items: center;
flex-wrap: wrap;
justify-content: space-around;
/*---------*/
}
.header .row{
margin-top: 70px;
}
.col-2{
flex-basis: 50%;
min-width: 300px;
}
.col-2 img{
max-width: 100%;
padding: 50px 0;
}
.col-2 h1{
font-size: 50px;
line-height: 60px;
margin: 25px 0;
}
.btn{
display: inline-block;
background: #ff523b;
color: #fff;
padding: 8px 30px;
margin: 30px 0;
border-radius: 30px;
transition: background 0.5s;
}
.btn:hover{
background: #563434;
}
/*-----------------------------*/
.categories{
margin: 70px 0;
}
.small-container{
max-width: 1080px;
margin: auto;
padding-left: 25px;
padding-right: 25px;
}
.col-3{
flex-basis: 30%;
min-width: 250px;
margin-bottom: 30px;
}
.col-3 img{
width: 100%;
}
/*----------------Featured Product----------------------*/
.title{
text-align: center;
margin: 0 auto 80px;
position: relative;
line-height: 60px;
color: #555;
}
.title::after{
content: '';
background: #ff523b;
width: 80px;
height: 5px;
border-radius: 5px;
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
}
.col-4{
flex-basis: 25%;
padding: 10px;
min-width: 200px;
margin-bottom: 50px;
transition: transform 0.5s;
}
.col-4 img{
width: 100%;
}
h4{
color: #555;
font-weight: normal;
}
.col-4 p{
font-size: 14px;
}
.rating .fa{
color: #ff523b;
}
.col-4:hover{
transform: translateY(-5px);
}
/*----------------------------offer------------------------------*/
.offer{
background: radial-gradient(#fff, #ffd6d6);
margin-top: 80px;
padding: 30px 0;
}
.col-2 .offer-img{
border-radius: 15% 30% 30% 5%;
padding: 50px;
}
small{
color: #555;
}
/*----------------------------Testimonial------------------------------*/
.testimonial{
padding-top: 100px;
}
.testimonial .col-3{
text-align: center;
padding: 40px 20px 40px;
box-shadow: 0 0 20px 0px rgba(0, 0, 0, 0.1);
cursor: pointer;
transition: transform 0.5s;
}
.testimonial .col-3 img{
width: 50px;
margin-top: 20px;
border-radius: 50%;
}
.fa.fa-quote-left{
font-size: 34px;
color: #ff523b;
}
.col-3 p{
font-size: 12px;
margin: 12px 0;
color: #777;
}
.testimonial .col-3 h3{
font-weight: 600;
color: #555;
font-size: 16px;
}
.testimonial .col-3:hover{
transform: translateY(-10px);
}
/*----------------------------Brands------------------------------*/
.brands{
margin: 100px auto;
}
.col-5{
width: 160px;
}
.col-5 img{
width: 100%;
cursor: pointer;
filter: grayscale(100%);
}
.col-5 img:hover{
filter: grayscale(0);
}
/*----------------------------Footer------------------------------*/
#footer{
position: relative;
height: 10%;
}
.footer{
background: #000;
color: #8a8a8a;
font-size: 14px;
padding: 60px 0 20px;
}
.footer p{
color: #8a8a8a;
}
.footer h3{
color: #fff;
margin-bottom: 20px;
}
.footer-col-1, .footer-col-2, .footer-col-3, .footer-col-4{
min-width: 250px;
margin-bottom: 20px;
}
.footer-col-1{
flex-basis: 30%;
}
.footer-col-2{
flex: 1;
text-align: center;
}
.footer-col-2 img{
width: 180px;
margin-bottom: 20px;
}
.footer-col-3, .footer-col-4{
flex-basis: 12%;
text-align: center;
}
.footer ul{
list-style-type: none;
background-color: #000;
}
.footer hr{
border: none;
background: #b5b5b5;
height: 1px;
margin: 20px 0;
}
.copyright{
text-align: center;
}
/*--------------media query for menu---------------*/
@media screen and (min-width: 800px){
}
/*---------------All Products----------------*/
.row-2{
justify-content: space-between;
margin: 100px auto 50px;
}
select{
border: 1px solid #ff523b;
padding: 5px;
}
select:focus{
outline: none;
}
.page-btn{
margin: 0 auto 80px;
}
.page-btn span{
display: inline-block;
border: 1px solid #ff523b;
margin-left: 10px;
width: 40px;
height: 40px;
text-align: center;
line-height: 40px;
cursor: pointer;
}
.page-btn span:hover{
background: #ff523b;
color: #fff;
}
解决方案
推荐阅读
- python - 以恒定时间检索堆栈中的最小元素
- angularjs - 在 AngularJS forEach 中添加延迟
- bash - 计算文件名字符,然后将这些文件复制到另一个目录
- c# - 使用下拉列表搜索不起作用
- ruby-on-rails - 带有父字段的 Ruby-on-Rails Where 子句
- hash - 用 160 位计算哈希冲突
- python-2.7 - 如何在odoo-11的create方法中调用向导?
- visual-studio-2015 - 构建/重建抛出 System.ExecutionEngineException 错误
- sql - SQL Server 正在尝试使用两个路径作为备份位置
- firebase - Firebase 存储更改图像方向