Home > Back-end >  Slideshow not coming under the Header
Slideshow not coming under the Header

Time:05-05

My slideshow is not coming under the header, it is next to the header. I tried flex but the slider just broke. I tried increasing the padding and margin but that did not work too.

The Problem

HTML CODE

HTML Code (Full Code)

      <div >
        <div >
          <input type="radio" name="radio-btn" id="radio1">
          <input type="radio" name="radio-btn" id="radio2">
          <input type="radio" name="radio-btn" id="radio3">
          <input type="radio" name="radio-btn" id="radio4">
          <div >
            <img src="img/Temp1.jfif" alt="">
          </div>
          <div >
            <img src="img/temp2.jpg" alt="">
          </div>
          <div >
            <img src="img/" alt="">
          </div>
          <div >
            <img src="img/" alt="">
          </div>
          
          <div >
            <div ></div>
            <div ></div>
            <div ></div>
            <div ></div>
          </div>
        </div>

        <div >
          <label for="radio1" ></label>
          <label for="radio2" ></label>
          <label for="radio3" ></label>
          <label for="radio4" ></label>
        </div>
      </div>

CSS CODE

CSS Code (Code too big)

JAVASCRIPT CODE

setInterval(function(){
  document.getElementById('radio'   counter).checked = true;
  counter  ;
  if(counter > 4){
    counter = 1;
  }
}, 5000);

Please Help me fix this bug.

CodePudding user response:

You should remove display: flex from body styles in CSS

body{
    margin-bottom: 1000px;
    padding: 0;
    height: 100vh;
    /*display: flex;*/ /*Remove this*/
    justify-content: center;
    align-items: center;
    background: white;
  }
  

  .slider{
    width: 800px;
    height: 500px;
    border-radius: 10px;
    overflow: hidden;
    align-content: bottom;
  }
  
  .slides{
    width: 500%;
    height: 500px;
    display: flex;
  }
  
  .slides input{
    display: none;
  }
  
  .slide{
    width: 20%;
    transition: 2s;
  }
  
  .slide img{
    width: 800px;
    height: 500px;
  }
  
  .navigation-manual{
    position: absolute;
    width: 800px;
    margin-top: -40px;
    display: flex;
    justify-content: center;
  }
  
  .manual-btn{
    border: 2px solid #40D3DC;
    padding: 5px;
    border-radius: 10px;
    cursor: pointer;
    transition: 1s;
  }
  
  .manual-btn:not(:last-child){
    margin-right: 40px;
  }
  
  .manual-btn:hover{
    background: #40D3DC;
  }
  
  #radio1:checked ~ .first{
    margin-left: 0;
  }
  
  #radio2:checked ~ .first{
    margin-left: -20%;
  }
  
  #radio3:checked ~ .first{
    margin-left: -40%;
  }
  
  #radio4:checked ~ .first{
    margin-left: -60%;
  }
  
  /*css for automatic navigation*/
  
  .navigation-auto{
    position: absolute;
    display: flex;
    width: 800px;
    justify-content: center;
    margin-top: 460px;
  }
  
  .navigation-auto div{
    border: 2px solid #40D3DC;
    padding: 5px;
    border-radius: 10px;
    transition: 1s;
  }
  
  .navigation-auto div:not(:last-child){
    margin-right: 40px;
  }
  
  #radio1:checked ~ .navigation-auto .auto-btn1{
    background: #40D3DC;
  }
  
  #radio2:checked ~ .navigation-auto .auto-btn2{
    background: #40D3DC;
  }
  
  #radio3:checked ~ .navigation-auto .auto-btn3{
    background: #40D3DC;
  }
  
  #radio4:checked ~ .navigation-auto .auto-btn4{
    background: #40D3DC;
  }
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Name</title>
</head>

<!--Connections-->
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="CSS/style.css">
<script src="TS/script.ts"></script>
<script src="JS/slide.js"></script>

<!--Header-->
<body>
  <div id="Header">
  <header >
    <div >
      <a >
        <img src="img/Fashion Bud Logo.png" width="70" height="70">
        <span >Name</span>
      </a>
      <nav >
        <a  style="cursor: pointer;">Home</a>
        <a  style="cursor: pointer;">Magazine</a>
        <a  style="cursor: pointer;">Gallery</a>
        <a  style="cursor: pointer;">Blog</a>
        <a  style="cursor: pointer;">Contact Us</a>
        </nav>
      </div>
    </header>
    </div>
  <hr >

  <!--Slider-->
      <div >
        <div >
          <input type="radio" name="radio-btn" id="radio1">
          <input type="radio" name="radio-btn" id="radio2">
          <input type="radio" name="radio-btn" id="radio3">
          <input type="radio" name="radio-btn" id="radio4">
          <div >
            <img src="img/Temp1.jfif" alt="">
          </div>
          <div >
            <img src="img/temp2.jpg" alt="">
          </div>
          <div >
            <img src="img/" alt="">
          </div>
          <div >
            <img src="img/" alt="">
          </div>
          
          <div >
            <div ></div>
            <div ></div>
            <div ></div>
            <div ></div>
          </div>
        </div>

        <div >
          <label for="radio1" ></label>
          <label for="radio2" ></label>
          <label for="radio3" ></label>
          <label for="radio4" ></label>
        </div>
      </div>
</body>
</html>

CodePudding user response:

Try this:

body{
  display: flex;
  flex-wrap: wrap;
}
header, .slider{
  width: 100%;
}
  • Related