The Rhino
The Rhino

Reputation: 1

now my footer covering my content and navbar

I have any issue, i have been make some footer and when i test my new footer, the Footer covered the content and navbar. i still figure it out how to solve this problem. hope i can get some answer at here...

$(".togel.tblmenu").click(function () {
  $(".menu").toggleClass("sh");
});
body {
   min-height: 400px;
   margin-bottom: 100px;
   clear: both;
  background: #eff2f7;
}

a {
  left: -50;
  text-decoration: none;
  color: white;
  display: block;
  transition: 0.3s;
  font-size: 20px
}

a:hover {
  transition: 0.3s;
}

nav {
  position: fixed;
  top: 0;
  left: 20px;
  right: 0;
  background: #1e77b0;
  font-family: Palatino Linotype;
}

.title {
  display: inline-block;
  float: left;
  line-height: 50px;
}

.menu {
  display: inline-block;
  float: left;
}

.menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.menu ul li {
  display: inline-block;
}

.menu ul li a {
  padding: 0 50px;
  display: block;
  line-height: 50px;
}

.menu li:hover {
  background-color: #009cff;
}

.wrap {
  width: 95%;
  margin: 0 auto;
}

.tblmenubox {
  display: inline-block;
  float: right;
  line-height: 50px;
}

.tblmenu {
  display: block;
  position: absolute;
  width: 25px;
  height: 25px;
  background: #1e77b0;
  border-radius: 50%;
  top: 50%;
  transform: translateY(-50%);
}

.tblmenubox {
  display: none;
  visibility: hidden;
}

.kotakpersegi {
  display: block;
  position: absolute;
  left: -40px;
  width: 250px;
  height: 50px;
  background: #009cff;
  transform: translateY(-50%);
  -webkit-transform: skew(30deg);
  -moz-transform: skew(30deg);
  -o- transform: skew(30deg);
  transform: skew(30deg)
}

.logo {
  position: absolute;
  left: 50px;
}

@media screen and (max-width:1000px) {
  .kotakpersegi {
    width: 150%;
  }
  .logo {
    position: absolute;
    float: center;
    left: 25%;
  }
  .menu {
    display: none;
  }
  .tblmenubox {
    display: block;
    visibility: visible;
  }
  .menu.sh {
    display: block;
    position: absolute;
    top: 50px;
    background: #1e77b0;
    width: 100%;
    left: 0;
  }
  .menu a:hover {
    color: #eff2f7;
   background: #009cff;
  }
  .menu ul li {
    display: block;
    text-align: center;
  }
}  




/*navbar code*/

.footer-bottom {
  text-align: center;
  background-color: #1e77b0;
  width: 100%;
    position: relative;
    bottom: 50%;
}

.Footer-header h3 {
  font-family: 'Roboto Condensed', sans-serif;
  color: white;
  margin: 20px;
  text-align: left;
}

.Footer-Sponsored img {
  height: 128px;
  margin: 10px;
}

hr {
  margin: 20px;
  border: 0.5px solid lightblue;
}

.hr1 {
  margin: 40px;
}

.Footer-deep {
  margin: 30px;
}
.Footer-deep img {
  height: 30px;
  margin: 10px;
}

.Footer-deep h3 {
  color: white;
  font-family: 'Garamond', sans-serif;
  font-size: 100%; 
}
.content-wrapper { /* added a top margin */
  margin-top: 50px; /* We know this is the height because it is applied specifically in CSS */
  padding: 30px;
}

.content-wrapper h1 {
  font-family: Palatino Linotype;
  text-align: center;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- font -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto+Condensed:ital,wght@1,300&display=swap" rel="stylesheet">
    

    
<!-- Navbar -->
<nav>
  <div class="wrap">
  <div class="title">
         <div class="kotakpersegi">
          <a href="">
            <img class="logo" src="img/logo.png" width="180" height="50">
          </a>
         </div>
  </div>
  <div class="tblmenubox">
    <div class="togel tblmenu">

    </div>
  </div>
  <div class="menu">
    <ul>
      <li><a href="#">Home</a></li>
      <li><a href="#">Contact</a></li>
      <li><a href="#">Service</a></li>
      <li><a href="#">Fiture</a></li>
      <li><a href="#">Maps</a></li>
    </ul>
  </div>
  </div>
</nav>

<!-- Navbar -->

<div class="content-wrapper">
  <h1>San Andreas Motor Racing Grand Prix</h1>
</div>

<!-- content stop here -->

<footer class="footer-bottom">
  <div class="Footer-header">
    <h2>San Andreas Motor Racing</h2>
    <hr class="Light-line">
    <h3>Sponsored By</h3>
  </div>
  <div class="Footer-Sponsored">
    <img src="Sponsored/1.jpg">
    <img src="Sponsored/2.png">
    <img src="Sponsored/3.jpg">
  </div>
  <hr class="hr1">
  <div class="Footer-deep">
    <img src="img/logo.png" align="left">
    <h3 align="right">San Andreas Motor Racing Championship</h3>
  </div>
</footer>

i have tried to change the position to relative absolute or whatever but it make me found another problem. maybee some one can help me to fix this problem, please.... i have been try to solve his problem by googling for a day and still doesn't have any clue about this problem...

Upvotes: 0

Views: 998

Answers (3)

Al1en
Al1en

Reputation: 9

You should change the z-order of your elements. Set z-index of footer less than z-index of the navbar (enough set z-index: -1 for footer)

More info: https://developer.mozilla.org/en-US/docs/Web/CSS/z-index

Upvotes: 0

Shahryar Mohajer
Shahryar Mohajer

Reputation: 589

Just add z-index:10 to nav css style

body {
   min-height: 400px;
   margin-bottom: 100px;
   clear: both;
  background: #eff2f7;
}

a {
  left: -50;
  text-decoration: none;
  color: white;
  display: block;
  transition: 0.3s;
  font-size: 20px
}

a:hover {
  transition: 0.3s;
}

nav {
  position: fixed;
  top: 0;
  left: 20px;
  right: 0;
  background: #1e77b0;
  font-family: Palatino Linotype;
  z-index:10;
}

.title {
  display: inline-block;
  float: left;
  line-height: 50px;
}

.menu {
  display: inline-block;
  float: left;
}

.menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.menu ul li {
  display: inline-block;
}

.menu ul li a {
  padding: 0 50px;
  display: block;
  line-height: 50px;
}

.menu li:hover {
  background-color: #009cff;
}

.wrap {
  width: 95%;
  margin: 0 auto;
}

.tblmenubox {
  display: inline-block;
  float: right;
  line-height: 50px;
}

.tblmenu {
  display: block;
  position: absolute;
  width: 25px;
  height: 25px;
  background: #1e77b0;
  border-radius: 50%;
  top: 50%;
  transform: translateY(-50%);
}

.tblmenubox {
  display: none;
  visibility: hidden;
}

.kotakpersegi {
  display: block;
  position: absolute;
  left: -40px;
  width: 250px;
  height: 50px;
  background: #009cff;
  transform: translateY(-50%);
  -webkit-transform: skew(30deg);
  -moz-transform: skew(30deg);
  -o- transform: skew(30deg);
  transform: skew(30deg)
}

.logo {
  position: absolute;
  left: 50px;
}

@media screen and (max-width:1000px) {
  .kotakpersegi {
    width: 150%;
  }
  .logo {
    position: absolute;
    float: center;
    left: 25%;
  }
  .menu {
    display: none;
  }
  .tblmenubox {
    display: block;
    visibility: visible;
  }
  .menu.sh {
    display: block;
    position: absolute;
    top: 50px;
    background: #1e77b0;
    width: 100%;
    left: 0;
  }
  .menu a:hover {
    color: #eff2f7;
   background: #009cff;
  }
  .menu ul li {
    display: block;
    text-align: center;
  }
}  




/*navbar code*/

.footer-bottom {
  text-align: center;
  background-color: #1e77b0;
  width: 100%;
    position: relative;
    bottom: 50%;
}

.Footer-header h3 {
  font-family: 'Roboto Condensed', sans-serif;
  color: white;
  margin: 20px;
  text-align: left;
}

.Footer-Sponsored img {
  height: 128px;
  margin: 10px;
}

hr {
  margin: 20px;
  border: 0.5px solid lightblue;
}

.hr1 {
  margin: 40px;
}

.Footer-deep {
  margin: 30px;
}
.Footer-deep img {
  height: 30px;
  margin: 10px;
}

.Footer-deep h3 {
  color: white;
  font-family: 'Garamond', sans-serif;
  font-size: 100%; 
}
.content-wrapper { /* added a top margin */
  margin-top: 50px; /* We know this is the height because it is applied specifically in CSS */
  padding: 30px;
}

.content-wrapper h1 {
    font-family: Palatino Linotype;
    text-align: center;
}
<!DOCTYPE html>
<html>
<head>
    <title>SA-MR</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <!-- CSS document -->
    <link rel="stylesheet" type="text/css" href="css/SAMRnavbar.css">
    <meta charset="utf-8">
  <!-- font -->
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Roboto+Condensed:ital,wght@1,300&display=swap" rel="stylesheet">

</head>
<body>

<!-- Navbar -->
    <nav>
      <div class="wrap">
      <div class="title">
             <div class="kotakpersegi">
                <a href="">
                    <img class="logo" src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Test-Logo.svg/1175px-Test-Logo.svg.png" width="180" height="50">
                </a>
             </div>
      </div>
      <div class="tblmenubox">
        <div class="togel tblmenu">

        </div>
      </div>
      <div class="menu">
        <ul>
          <li><a href="#">Home</a></li>
          <li><a href="#">Contact</a></li>
          <li><a href="#">Service</a></li>
          <li><a href="#">Fiture</a></li>
          <li><a href="#">Maps</a></li>
        </ul>
      </div>
      </div>
    </nav>
    <script src="js/jquery.min.js"></script>
    <script type="text/javascript">
      $(".togel.tblmenu").click(function () {
      $(".menu").toggleClass("sh");
      });
    </script>
<!-- Navbar -->

<div class="content-wrapper">
  <h1>San Andreas Motor Racing Grand Prix</h1>
</div>

<!-- content stop here -->

<footer class="footer-bottom">
  <div class="Footer-header">
    <h2>San Andreas Motor Racing</h2>
    <hr class="Light-line">
    <h3>Sponsored By</h3>
  </div>
  <div class="Footer-Sponsored">
    <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Test-Logo.svg/1175px-Test-Logo.svg.png">
    <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Test-Logo.svg/1175px-Test-Logo.svg.png">
    <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Test-Logo.svg/1175px-Test-Logo.svg.png">
  </div>
  <hr class="hr1">
  <div class="Footer-deep">
    <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Test-Logo.svg/1175px-Test-Logo.svg.png" align="left">
    <h3 align="right">San Andreas Motor Racing Championship</h3>
  </div>
</footer>

</body>
</html>

Upvotes: 1

Maggie Cody
Maggie Cody

Reputation: 679

This can be resolved by adding 'z-index: -1;' to your footer-bottom class.

Learn more about z-indexing here

In the most basic cases, HTML pages can be considered two-dimensional, because text, images, and other elements are arranged on the page without overlapping. In this case, there is a single rendering flow, and all elements are aware of the space taken by others. The z-index attribute lets you adjust the order of the layering of objects when rendering content.

In addition to their horizontal and vertical positions, boxes lie along a "z-axis" and are formatted one on top of the other. Z-axis positions are particularly relevant when boxes overlap visually. https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index

Upvotes: 0

Related Questions