footer {
background-color: #000000
}
.footer-nav {
list-style: none;
}
.footer-nav li {
display: inline-block;
margin: 15px;
font-weight: 400;
font-size: 80%
}
.social {
list-style: none;
}
.social li {
display: inline-block;
margin: 15px;
float: right;
font-size: 150%
}
.footer-nav li a,
.social li a {
text-decoration: none;
}
.footer-nav li a:link,
.footer-nav li a:visited {
color: #4b4b4b;
}
.footer-nav li a:hover,
.footer-nav li a:active {
color: #9d9c9c;
}
.social li:first-child {
margin-right: 0;
}
.social li a,
.social li a {
text-decoration: none;
}
.social li a:link,
.social li a:visited {
color: #4b4b4b;
}
.ion-logo-youtube:hover,
.ion-logo-youtube:active {
color: #FF0000;
}
.ion-logo-facebook:hover,
.ion-logo-facebook:active {
color: #3B5998;
}
.ion-logo-instagram:hover,
.ion-logo-instagram:active {
color: #fb3958;
}
.ion-logo-github:hover,
.ion-logo-github:active {
color: #8d8d8d;
}
.copy {
margin-left: auto;
margin-right: auto;
text-align: center;
padding-bottom: 10px;
font-size: 80%;
}
.copy h2 {
word-spacing: 4px;
padding-bottom: 10px;
font-size: 80%;
padding-top: 20px;
border-width: thick
}
.copy i {
color: red;
}
.love {
margin-bottom: 5px;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="Vendor/css/normalize.css">
<link rel="stylesheet" type="text/css" href="Vendor/css/grid.css">
<link rel="stylesheet" type="text/css" href="vendor/css/generic.css" />
<link rel="stylesheet" type="text/css" href="vendor/css/style.css" />
<link rel="stylesheet" type="text/css" href="Resources/css/styles.css">
<link rel="stylesheet" href="https://unpkg.com/ionicons@4.3.0/dist/css/ionicons.min.css">
<link rel="stylesheet" type="text/css" href="vendor/css/js-image-slider.css">
<link href="https://fonts.googleapis.com/css?family=Lato:100,300,300i,400" rel="stylesheet" type="text/css">
<title>Homepage</title>
<link rel="apple-touch-icon" sizes="180x180" href="/resources/favicons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/resources/favicons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/resources/favicons/favicon-16x16.png">
<link rel="manifest" href="/resources/favicons/site.webmanifest">
<link rel="mask-icon" href="/resources/favicons/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="/resources/favicons/favicon.ico">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-config" content="/resources/favicons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
</head>
<body>
<header>
</header>
<footer>
<div class="row">
<div class="col span-1-of-2">
<ul class="footer-nav">
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Our blog</a></li>
<li><a href="#">Reach us</a></li>
</ul>
</div>
<div class="col span-1-of-2">
<ul class="social">
<li><a href="#"><i class="icon ion-logo-youtube"></i></a></li>
<li><a href="https://mbasic.facebook.com/pawankumar.gupta.712" target="_blank"><i class="icon ion-logo-facebook"></i></a></li>
<li><a href="#"><i class="icon ion-logo-instagram"></i></a></li>
<li><a href="#"><i class="icon ion-logo-github"></i></a></li>
</ul>
</div>
</div>
<div class="row copy">
<p class="love">
Made with <i class="icon ion-md-heart"></i>
</p>
<h2>
Copyright © 2018 by Noobalert. All right reserved.
</h2>
</div>
</footer>
</body>
footer {
background-color: #000000
}
.footer-nav {
list-style: none;
}
.footer-nav li {
display: inline-block;
margin: 15px;
font-weight: 400;
font-size: 80%
}
.social {
list-style: none;
}
.social li {
display: inline-block;
margin: 15px;
float: right;
font-size: 150%
}
.footer-nav li a,
.social li a {
text-decoration: none;
}
.footer-nav li a:link,
.footer-nav li a:visited {
color: #4b4b4b;
}
.footer-nav li a:hover,
.footer-nav li a:active {
color: #9d9c9c;
}
.social li:first-child {
margin-right: 0;
}
.social li a,
.social li a {
text-decoration: none;
}
.social li a:link,
.social li a:visited {
color: #4b4b4b;
}
.ion-logo-youtube:hover,
.ion-logo-youtube:active {
color: #FF0000;
}
.ion-logo-facebook:hover,
.ion-logo-facebook:active {
color: #3B5998;
}
.ion-logo-instagram:hover,
.ion-logo-instagram:active {
color: #fb3958;
}
.ion-logo-github:hover,
.ion-logo-github:active {
color: #8d8d8d;
}
.copy {
margin-left: auto;
margin-right: auto;
text-align: center;
padding-bottom: 10px;
font-size: 80%;
}
.copy h2 {
word-spacing: 4px;
padding-bottom: 10px;
font-size: 80%;
padding-top: 20px;
border-width: thick
}
.copy i {
color: red;
}
.love {
margin-bottom: 5px;
}
<footer>
<div class="row">
<div class="col span-1-of-2">
<ul class="footer-nav">
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Our blog</a></li>
<li><a href="#">Reach us</a></li>
</ul>
</div>
<div class="col span-1-of-2">
<ul class="social">
<li><a href="#"><i class="icon ion-logo-youtube"></i></a></li>
<li><a href="https://mbasic.facebook.com/pawankumar.gupta.712" target="_blank"><i class="icon ion-logo-facebook"></i></a></li>
<li><a href="#"><i class="icon ion-logo-instagram"></i></a></li>
</ul>
</div>
</div>
<div class="row copy">
<p class="love">
Made with <i class="icon ion-md-heart"></i>
</p>
<h2>
Copyright © 2018. All right reserved.
</h2>
</div>
</footer>
问题
为什么我没有将页脚放在页面的最低侧......它在底部给出背景色。如何在代码中解决此问题。 我设法做了一些可能的解决方案,但我失败了,所以我在这里问伟大的头脑.我是HTML CSS的新手,所以感谢每一个答案。 提前感谢..... ;)
欢迎使用堆栈溢出 Vivek,如果您的问题是页脚和页面底部之间的空白区域,您可以使用 CSS 重置代码修复它。
默认情况下,某些 Web 浏览器会向某些 HTML 元素添加自动边距、填充等。为了删除这些自动样式,您可以使用如下所示的代码段,该代码称为样式.css文件中的CSS重置代码:
* CSS RESET */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
您可以简单地将此 CSS 添加到您的代码中:
.footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
text-align: center;
}