Weird space on page with slick slider?

Viewed 1052

I'm creating a website with slick slider and have got the plugin working smoothly, but there is a weird space on the left that is causing the site to have a horizontal slider. I have tried maxing out the viewports of the containers but to no avail? Is there a way to remove this white space so that there is no horizontal slider.

$(document).ready(function(){
    $('.forss').slick({
        centerMode: true,
        centerPadding: '0w',
        slidesToShow: 3.625,
      });
  });
// navigation.css

body {
    background-color: #5336F8;
    font-family: Futura PT;
}
ul {
    position: relative;
    left: 3vw;
    list-style-type: none;
    overflow: hidden;
    margin: 3vw 1vw 0 0;
    background-color: transparent;
    display: inline-block;
}

li {
    float: right;
    font-size: 1.5vw;
}


li a {
    display: block;
    font-weight: lighter;
    float: right;
    color: white;
    margin: 0 0.5vw 0 0.5vw;
    text-align: center;
    padding: 0.75vw 2vw;
    text-decoration: none;
}

li a:not(.active):hover {
    background-color: white;
    color: #5336F8;
    border: 1px; 
}

.active {
    border: 1px solid white;
}



.logo {
    font-family: Futura PT;
    float: left;
    font-size: 4vw;
    margin: 2vw 5vw 0 3.5vw;
    color: white;
    font-weight: 550;
}

.logo:hover {
    color: #5336F8;
    text-shadow: 1px 0 white, 0 1px white, 1px 0 white, 0 -1px white;
}

// style.css


div.slick-slider {
    width:100vw;
}

.forss {
    display: flex;
    align-items: center;
    box-sizing: border-box;
}

.forss .items {
    width: 30vw;
    height: 35vw;
    margin-top: 7vw;
}

.forss .items img {
    width: 24.840625vw;
    height: 31.25vw;
}

.slick-slide {
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    transform: scale(1);
    
    transition:transform 0.5s ease-in-out;
}

.slick-slide:focus {
        outline: none;
}

div.slick-track {
    width: 100vw;
}

div.slick-center {
    -webkit-transform: scale(1.15);
    -moz-transform: scale(1.15);
    transform: scale(1.15);
    transition: transform 0.5s ease-in-out;
}

#arrows {
    width: 1vw;
    height: 1vw;
    text-align: center;
    position: relative;

}

.logo {
    font-family: 'Futura-Normal';
    font-size: 4vw;
    color: white;
    float: left;
    margin-left: 2vw;
}

.top  {
    position: absolute;
    mix-blend-mode: screen;
    left: 0;
    right: 0;
    opacity: 100%;
    transition: opacity 0.15s;
}

.top:hover {
    opacity: 0%;
}

.bottom img {
    position: relative;
    left: 0;
    right: 0;
}


input.prev:focus {
    outline-width: 0;
}

input.next:focus {
    outline-width: 0;
}

.add-on {
    font-family: (var(--font));
    font-size: 1.75vw;
    color: white;
    margin-left: 2vw;
    margin-right: 2vw;
    margin-bottom: 1vw;
}

#inner {
    position: relative;
    width: 100vw;
    margin-bottom: 4vw;
}

#centered {
    text-align: center;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
    <title>Slider</title>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.9.0/slick.min.css" rel="stylesheet"/>
  <!--style.css-->
    <link rel="stylesheet" href="https://drive.google.com/uc?export=view&id=1T5ZdOkN6sg2weNQkehStYX2mDo1f0ajJ">
<!--navigation.css-->
    <link rel="stylesheet" href="https://drive.google.com/uc?export=view&id=1IgyMKG47riH_HmnHoPLH16qhI0UtnK34">

</head>

<body>
    <h2 class="logo">The Lowdown.</h2>

    <ul>
        <li><a  href="text.html">CONTACT US</a></li>
        <li><a class="active" href="#edition">EDITIONS</a></li>
        <li><a href="#articles">ARTICLES</a></li>
        <li><a href="#aboutus">ABOUT US</a></li>
        <li><a href="#home">HOME</a></li>
        
      </ul>

    <div class="forss">
        <div class="items">
            <img src="https://i.ibb.co/FWpLzhw/April-Edition-Overlay.png" class="top" alt="" >
            <img src="https://lh3.googleusercontent.com/FbRKb0dt5bz6QOt34jA7jl43XFkHFQf7T0j3wL6b1Z0zSVMNO2DlWl7UAUoTd_dDvCZFhbW822HYyJJQkgH8K0o2dXUrv5uzZl2qrXYF7UWVqqHVinvAqdqz057ULytRu9IE3N0pIw=w2400" class="bottom" alt="">
        </div> 
        <div class="items">
            <img src="https://i.ibb.co/FWpLzhw/April-Edition-Overlay.png" class="top" alt="" >
            <img src="https://i.ibb.co/h2VBt78/May-Edition-Back.png" class="bottom" alt="">
        </div>
        <div class="items">
            <img src="https://i.ibb.co/FWpLzhw/April-Edition-Overlay.png" class="top" alt="" >
            <img src="https://lh3.googleusercontent.com/FbRKb0dt5bz6QOt34jA7jl43XFkHFQf7T0j3wL6b1Z0zSVMNO2DlWl7UAUoTd_dDvCZFhbW822HYyJJQkgH8K0o2dXUrv5uzZl2qrXYF7UWVqqHVinvAqdqz057ULytRu9IE3N0pIw=w2400" class="bottom" alt="">
        </div>
        <div class="items">
            <img src="https://i.ibb.co/FWpLzhw/April-Edition-Overlay.png" class="top" alt="" >
            <img src="https://i.ibb.co/h2VBt78/May-Edition-Back.png" class="bottom" alt="">
        </div>
        <div class="items">
            <img src="https://i.ibb.co/FWpLzhw/April-Edition-Overlay.png" class="top" alt="" >
            <img src="https://lh3.googleusercontent.com/FbRKb0dt5bz6QOt34jA7jl43XFkHFQf7T0j3wL6b1Z0zSVMNO2DlWl7UAUoTd_dDvCZFhbW822HYyJJQkgH8K0o2dXUrv5uzZl2qrXYF7UWVqqHVinvAqdqz057ULytRu9IE3N0pIw=w2400" class="bottom" alt="">
        </div>
    </div>
<div id="inner">
    <div id="centered">
        <input type="image" name="previous" src="https://i.ibb.co/dt3fngT/previous-arrow.png" class="prev" id="arrows" alt="Tool Tip"><span class="add-on">         READ ME         </span><input type="image" name="next" src="https://i.ibb.co/nL7jtPS/next-arrow.png" class="next" id="arrows" alt="Tool Tip">
    </div>
</div>

<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="js/custom.js"></script>
<script src="https://drive.google.com/uc?export=view&id=1jzlbwu186Lrp0yF_NIcH9Zk2tSFA2PdL"></script>

1 Answers

There are some issues with using the viewport width (vw) for the slideshow elements (slideshow and slide navigation). Since there is padding on the body element, the content width will include that, which forces the page width to equal (viewport width + body left padding + body right padding). I was able to remove the horizontal scrollbar by changing/adding the CSS below:

div.slick-slider {
    // width:100vw;
}

#inner {
    width: 100% !important;
    ...
}

body {
    margin-left: 0;
    margin-right: 0;
    ...
}

Note: these changes may not be reflected in the SO preview below. For some reason, I'm not seeing the updates to the .slick-slider and body CSS reflected there.

$(document).ready(function(){
    $('.forss').slick({
        centerMode: true,
        centerPadding: '0w',
        slidesToShow: 3.625,
      });
  });
// navigation.css

body {
    background-color: #5336F8;
    font-family: Futura PT;
    margin-left: 0;
    margin-right: 0;
}
ul {
    position: relative;
    left: 3vw;
    list-style-type: none;
    overflow: hidden;
    margin: 3vw 1vw 0 0;
    background-color: transparent;
    display: inline-block;
}

li {
    float: right;
    font-size: 1.5vw;
}


li a {
    display: block;
    font-weight: lighter;
    float: right;
    color: white;
    margin: 0 0.5vw 0 0.5vw;
    text-align: center;
    padding: 0.75vw 2vw;
    text-decoration: none;
}

li a:not(.active):hover {
    background-color: white;
    color: #5336F8;
    border: 1px; 
}

.active {
    border: 1px solid white;
}



.logo {
    font-family: Futura PT;
    float: left;
    font-size: 4vw;
    margin: 2vw 5vw 0 3.5vw;
    color: white;
    font-weight: 550;
}

.logo:hover {
    color: #5336F8;
    text-shadow: 1px 0 white, 0 1px white, 1px 0 white, 0 -1px white;
}

// style.css


div.slick-slider {
    // width:100vw;
}

.forss {
    display: flex;
    align-items: center;
    box-sizing: border-box;
}

.forss .items {
    width: 30vw;
    height: 35vw;
    margin-top: 7vw;
}

.forss .items img {
    width: 24.840625vw;
    height: 31.25vw;
}

.slick-slide {
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    transform: scale(1);
    
    transition:transform 0.5s ease-in-out;
}

.slick-slide:focus {
        outline: none;
}

div.slick-track {
    margin: 0;
}

div.slick-center {
    -webkit-transform: scale(1.15);
    -moz-transform: scale(1.15);
    transform: scale(1.15);
    transition: transform 0.5s ease-in-out;
}

#arrows {
    width: 1vw;
    height: 1vw;
    text-align: center;
    position: relative;

}

.logo {
    font-family: 'Futura-Normal';
    font-size: 4vw;
    color: white;
    float: left;
    margin-left: 2vw;
}

.top  {
    position: absolute;
    mix-blend-mode: screen;
    left: 0;
    right: 0;
    opacity: 100%;
    transition: opacity 0.15s;
}

.top:hover {
    opacity: 0%;
}

.bottom img {
    position: relative;
    left: 0;
    right: 0;
}


input.prev:focus {
    outline-width: 0;
}

input.next:focus {
    outline-width: 0;
}

.add-on {
    font-family: (var(--font));
    font-size: 1.75vw;
    color: white;
    margin-left: 2vw;
    margin-right: 2vw;
    margin-bottom: 1vw;
}

#inner {
    position: relative;
    width: 100% !important;
    margin-bottom: 4vw;
}

#centered {
    text-align: center;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
    <title>Slider</title>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.9.0/slick.min.css" rel="stylesheet"/>
  <!--style.css-->
    <link rel="stylesheet" href="https://drive.google.com/uc?export=view&id=1T5ZdOkN6sg2weNQkehStYX2mDo1f0ajJ">
<!--navigation.css-->
    <link rel="stylesheet" href="https://drive.google.com/uc?export=view&id=1IgyMKG47riH_HmnHoPLH16qhI0UtnK34">

</head>

<body>
    <h2 class="logo">The Lowdown.</h2>

    <ul>
        <li><a  href="text.html">CONTACT US</a></li>
        <li><a class="active" href="#edition">EDITIONS</a></li>
        <li><a href="#articles">ARTICLES</a></li>
        <li><a href="#aboutus">ABOUT US</a></li>
        <li><a href="#home">HOME</a></li>
        
      </ul>

    <div class="forss">
        <div class="items">
            <img src="https://i.ibb.co/FWpLzhw/April-Edition-Overlay.png" class="top" alt="" >
            <img src="https://lh3.googleusercontent.com/FbRKb0dt5bz6QOt34jA7jl43XFkHFQf7T0j3wL6b1Z0zSVMNO2DlWl7UAUoTd_dDvCZFhbW822HYyJJQkgH8K0o2dXUrv5uzZl2qrXYF7UWVqqHVinvAqdqz057ULytRu9IE3N0pIw=w2400" class="bottom" alt="">
        </div> 
        <div class="items">
            <img src="https://i.ibb.co/FWpLzhw/April-Edition-Overlay.png" class="top" alt="" >
            <img src="https://i.ibb.co/h2VBt78/May-Edition-Back.png" class="bottom" alt="">
        </div>
        <div class="items">
            <img src="https://i.ibb.co/FWpLzhw/April-Edition-Overlay.png" class="top" alt="" >
            <img src="https://lh3.googleusercontent.com/FbRKb0dt5bz6QOt34jA7jl43XFkHFQf7T0j3wL6b1Z0zSVMNO2DlWl7UAUoTd_dDvCZFhbW822HYyJJQkgH8K0o2dXUrv5uzZl2qrXYF7UWVqqHVinvAqdqz057ULytRu9IE3N0pIw=w2400" class="bottom" alt="">
        </div>
        <div class="items">
            <img src="https://i.ibb.co/FWpLzhw/April-Edition-Overlay.png" class="top" alt="" >
            <img src="https://i.ibb.co/h2VBt78/May-Edition-Back.png" class="bottom" alt="">
        </div>
        <div class="items">
            <img src="https://i.ibb.co/FWpLzhw/April-Edition-Overlay.png" class="top" alt="" >
            <img src="https://lh3.googleusercontent.com/FbRKb0dt5bz6QOt34jA7jl43XFkHFQf7T0j3wL6b1Z0zSVMNO2DlWl7UAUoTd_dDvCZFhbW822HYyJJQkgH8K0o2dXUrv5uzZl2qrXYF7UWVqqHVinvAqdqz057ULytRu9IE3N0pIw=w2400" class="bottom" alt="">
        </div>
    </div>
<div id="inner">
    <div id="centered">
        <input type="image" name="previous" src="https://i.ibb.co/dt3fngT/previous-arrow.png" class="prev" id="arrows" alt="Tool Tip"><span class="add-on">         READ ME         </span><input type="image" name="next" src="https://i.ibb.co/nL7jtPS/next-arrow.png" class="next" id="arrows" alt="Tool Tip">
    </div>
</div>

<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="js/custom.js"></script>
<script src="https://drive.google.com/uc?export=view&id=1jzlbwu186Lrp0yF_NIcH9Zk2tSFA2PdL"></script>

Related