Home > Mobile >  How to remove blanks in my slider ( Trying full screen slider )
How to remove blanks in my slider ( Trying full screen slider )

Time:04-14

sorry for the this basic question. I am new on front-end. And triying create a responsive portfolio site. And this is my problem actually I am trying full screen slider. How can I remove blanks and How can I do full stretch screen slider. My idea full screen background slider. Any code for remove or strech for images . Any idea for this ?

HTML CSS JSResult Skip Results Iframe * {
  margin: 0;
  box-sizing: border-box;
}


/* JS */

slider>content {
  display: none
}


/* Content General */

slider {
  background-color: #9e9e9e;
  height: 100vh;
  width: 100%;
  position: relative;
  display: flex;
  justify-content: center;
}


/* Content */

slider .contents {
  overflow: hidden;
  height: 100%;
  width: 100%;
  position: relative;
  background-size: cover;
  transition: all .5s ease;
}

slider content {
  height: 100%;
  width: 100%;
  position: absolute;
  top: 0;
  display: block;
  transform: translate(100%, 0);
}

slider content:nth-of-type(1) {
  transform: translate(0%, 0);
}


/* Arrows */

slider .ArrowLeft,
slider .ArrowRight {
  position: absolute;
  height: 100%;
  width: 2em;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

slider .ArrowLeft {
  left: 0px;
}

slider .ArrowRight {
  right: 0px;
}


/* Selector */

slider .Selectores {
  padding: 40px;
  position: absolute;
  bottom: -1.5em;
  gap: 10px;
  display: flex;
  justify-content: space-between;
}

slider .Selectores>div {
  background-color: #000;
  height: 10px;
  width: 10px;
  display: block;
  border-radius: 5px;
  cursor: pointer;
}

slider .Selectores>div.Activo {
  background-color: #999999;
}
<body>
    <slider arrows="true" selec="true" autoplay="4">
      <content style="background-image: url(https://unsplash.it/500/300/)"></content>
      <content style="background-image: url(https://unsplash.it/501/301/)"></content>
      <content style="background-image: url(https://unsplash.it/502/302/)"></content>
    </slider>
  
  <script src="./script.js"></script>
</body>

CodePudding user response:

There is a css reset you can add to the body tag.

/* ADD THIS CSS RESET */
body {
  padding: 0;
  margin: 0;
  overflow: hidden
}

HTML CSS JSResult Skip Results Iframe * {
  margin: 0;
  box-sizing: border-box;
}


/* JS */

slider>content {
  display: none
}


/* Content General */

slider {
  background-color: #9e9e9e;
  height: 100vh;
  width: 100%;
  position: relative;
  display: flex;
  justify-content: center;
}


/* Content */

slider .contents {
  overflow: hidden;
  height: 100%;
  width: 100%;
  position: relative;
  background-size: cover;
  transition: all .5s ease;
}

slider content {
  height: 100%;
  width: 100%;
  position: absolute;
  top: 0;
  display: block;
  transform: translate(100%, 0);
}

slider content:nth-of-type(1) {
  transform: translate(0%, 0);
}


/* Arrows */

slider .ArrowLeft,
slider .ArrowRight {
  position: absolute;
  height: 100%;
  width: 2em;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

slider .ArrowLeft {
  left: 0px;
}

slider .ArrowRight {
  right: 0px;
}


/* Selector */

slider .Selectores {
  padding: 40px;
  position: absolute;
  bottom: -1.5em;
  gap: 10px;
  display: flex;
  justify-content: space-between;
}

slider .Selectores>div {
  background-color: #000;
  height: 10px;
  width: 10px;
  display: block;
  border-radius: 5px;
  cursor: pointer;
}

slider .Selectores>div.Activo {
  background-color: #999999;
}
<body>
    <slider arrows="true" selec="true" autoplay="4">
      <content style="background-image: url(https://unsplash.it/500/300/)"></content>
      <content style="background-image: url(https://unsplash.it/501/301/)"></content>
      <content style="background-image: url(https://unsplash.it/502/302/)"></content>
    </slider>
  
  <script src="./script.js"></script>
</body>

  • Related