skip to Main Content

I have this problem with the footer since I added these properties to my background image, If I don’t add these properties, then the page will have a blank space between the background image and the footer, can anyone help please?:

margin-bottom: -100px;
padding-bottom: 0;

CSS and HTML code below:

@import url('https://fonts.googleapis.com/css?family=Gloria+Hallelujah:100,200,300,400,500,600,700|Special+Elite:100,200,300,400,500,600,700');
/*---------------------------------Navigation Bar*/ 

/*----Navbar Buttons*/
.navbar-nav  li  a {
  color: #ffffff !important;
  font-family: "Gloria Hallelujah" , sans-serif;
  text-transform: uppercase;
  font-size: large;
  font-weight: 500;
  text-decoration: none;
  border:none;
  padding: 8px 8px;
  margin:4px 2px;
}

nav li  a,
nav li  a:after,
nav li  a:before {
  transition: all .5s;
}
#navbar-select-color:hover {
  color: #c8c8c8 !important;
}

#logo-transparent {
  opacity: 1.0;
  filter: alpha(opacity=50);
  transition-timing-function: ease-in-out;
  transition: all .5s;
}

#logo-transparent:hover {
  opacity: 0.8;
  filter: alpha(opacity=100);
  transition-timing-function: ease-in-out;
  transition: all .5s;
}
/*----Navbar Animation*/
nav.stroke ul li a {
  position: relative;
}

nav.stroke ul li a:after {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  margin: auto;
  width: 0%;
  content: '.';
  color: transparent;
  background: #aaa;
  height: 1px;
}
nav.stroke ul li a:hover:after {
  width:100%;
}

/*---------------------------------Footer*/
footer {
  background: #212529;
  color: white;
  margin-top:100px;
  bottom: 0;
}

footer a {
  color: #fff;
  font-size: 14px;
  transition-duration: 0.2s;
}

footer a:hover {
  color: #ced3d7;
  text-decoration: none;
}

.copy {
  font-size: 12px;
  padding: 10px;
  border-top: 1px solid #FFFFFF;
}

.footer-middle {
  padding-top: 2em;
  color: white;
}


/*---------------------------------Social Icons*/

/* footer social icons */

ul {
  list-style-type: none;
  display: flex;
  justify-content: center;

}

ul .social-network {
  display: inline;
  margin-left: 0 !important;
  padding: 0;
  float: center;
  
}

 ul .social-network li {
  display: inline;
  margin: 0 5px;
  list-style: none;
}


.social-network a.icoTwitter:hover i {
  color: #007bb7;
}
.social-network a.icoFacebook:hover i {
  color: #3B5998;
}

.social-network a.icoYoutube:hover i {
  color: #c4302b;
}


.social-circle li a {
  display: block;
  position: relative;
  margin: 15px 15px 15px;
  -moz-border-radius: 50%;
  -webkit-border-radius: 50%;
  border-radius: 50%;
  text-align: center;
  width: 65px;
  height: 65px;
  font-size:40px;

}

.social-circle li i {
  margin: 0;
  line-height: 30px;
  text-align: center;
}

.social-circle li a:hover i,
.triggeredHover {
  -moz-transform: rotate(360deg);
  -webkit-transform: rotate(360deg);
  -ms--transform: rotate(360deg);
  transform: rotate(360deg);
  -webkit-transition: all 0.2s;
  -moz-transition: all 0.2s;
  -o-transition: all 0.2s;
  -ms-transition: all 0.2s;
  transition: all 0.2s;
}

.social-circle i {
  color: #595959;
  -webkit-transition: all 0.8s;
  -moz-transition: all 0.8s;
  -o-transition: all 0.8s;
  -ms-transition: all 0.8s;
  transition: all 0.8s;
}

.social-network a {
  background-color: #F9F9F9;
}

/*---------------------------------Background*/

body, html {
  height: 100%;
}

img {
  width:100%;
  height:auto;
  position: relative;
  
}

#bg {

  /* Full height */
  height: 100%;


  /* Center and scale the image nicely */
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  width: 100%;
  height: 100%;
  margin-bottom: -100px;
  padding-bottom: 0;
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" type="text/css" />
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css" />
    <link rel="stylesheet" href="assets/css/style.css" type="text/css" />
    <title>Home|The Monkees</title>
</head>
<body>
  <header>
<!--------------------Navigation-->
    <nav class="navbar navbar-expand-sm bg-dark navbar-dark stroke">
      <a class="navbar-brand" href="index.html">
        <img src="assets/image/LOGO.png" id="logo-transparent" alt="logo" style="width:143px;">
      </a>
      <button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#navbarCollapse">
        <span class="navbar-toggler-icon"></span>
      </button>
    
    <div class="collapse navbar-collapse" id="navbarCollapse">  
      <ul class="navbar-nav">
        <li class="nav-item">
          <a class="nav-link " id="navbar-select-color" href="index.html">Home</a>
        </li>
        
        <li class="nav-item">
          <a class="nav-link" id="navbar-select-color" href="music.html">Music</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" id="navbar-select-color" href="video.html">Video</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" id="navbar-select-color" href="shop.html">Shop</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" id="navbar-select-color" href="contact.html">Contact</a>
        </li>
      </ul>
    </div>
    </nav>
  </header>
  <section>
    <div id="bg">
      <img src="assets/image/monkees_portrait_402.jpg" alt="">
    </div>
  </section>

<footer class="mainfooter bg-dark " role="contentinfo">
  <div class="footer-middle">
      <ul class="social-network social-circle">
             <li><a href="https://www.facebook.com/" class="icoFacebook" title="Facebook"><i class="fa fa-facebook"></i></a></li>
             <li><a href="https://twitter.com/" class="icoTwitter" title="Twitter"><i class="fa fa-twitter"></i></a></li>
             <li><a href="https://www.youtube.com" class="icoYoutube" title="Youtube"><i class="fa fa-youtube"></i></a></li>
             
      </ul>	
	<div class="col-md-12 copy">
			<p class="text-center">&copy; Copyright 2019 - The Monkees.  All rights reserved. //<a href="about.html"> About </a> //<a href="privacy_policy.html"> Privacy Policy </a> //<a href="terms_of_use.html"> Terms of Use </a> //<a href="contact.html"> Contact </a></p>
  
	</div>
  </div>
</footer>
  
</body>
</html>

Some advice on the color of the footer and navbar compared to the image would be a greatly appreciated. This is for a project.

Thanks

3

Answers


  1. You can adjust footer class. specially margin-top

    like this:

        footer {
      margin-top:50px;
    }
    
    Login or Signup to reply.
  2. In footer tag you just need to remove the margin-top:100px;

    only this

    footer {
      background: #212529;
      color: white;
      bottom: 0;
    }
    

    this will work

    Login or Signup to reply.
  3. Since you did not upload the images I haven´t been able to test it properly, if you wanted the footer to be right at the bottom, change the following:

    `footer {background: #212529;
     color: white;
     margin-top:100px;
     position: absolute;
     /*--Your body does not cover the entire screen´s height therefore the 
     -20px--*/
     bottom: -20px;
    }`
    

    I cannot undestand why you give it a margin-top, but it may have to do with the rest of the content or libraries we do not have acces to (bootstrap, images..), I hope it still helps 🙂

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search