如何调整页脚位置html css

时间:2018-09-09 17:46:14

标签: javascript html css styles footer

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 &nbsp; <i class="icon ion-md-heart"></i>
      </p>
      <h2>
        Copyright &copy; 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 &nbsp; <i class="icon ion-md-heart"></i>
      </p>
      <h2>
        Copyright &copy; 2018. All right reserved.
      </h2>
    </div>
  </footer>

problem

为什么我没有将页脚放到页面的最低端...它在底部提供背景颜色。...如何解决我代码中的问题。 我设法做了一些可能的解决方案,但是我失败了,所以我在这里问个好主意。我对html css还是很陌生,所以请为每一个答案感谢。 在此先感谢.....;)

2 个答案:

答案 0 :(得分:1)

欢迎堆栈溢出Vivek,如果问题是页脚和页面底部之间的空白,则可以使用CSS重置代码对其进行修复。

默认情况下,某些Web浏览器会向某些HTML元素添加自动边距,填充等。为了删除这些自动样式,您可以在 style.css 文件中使用以下代码,称为 CSS RESET代码

* 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;
}

答案 1 :(得分:0)

您可以简单地将此CSS添加到您的代码中:

.footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    text-align: center;
}