Exploring the Limitless Possibilities of Bootstrap 5 Horizontal Scrolling

Each time I create a new page, there is a slight horizontal scrolling issue that occurs. When the page scrolls horizontally, it leads to a white space where nothing exists beyond the footer and header at the edge of the screen. Even though it's just a small amount, it's quite bothersome because the scroll bar occupies unnecessary space on my small laptop. [notice the white space to the side of the header.][1] [1]: https://i.sstatic.net/mHSDx.png

Since this problem persists on every single page, I suspect it has something to do with the CSS styling for either the header or the footer. However, I'm finding it challenging to pinpoint the exact cause. I have attached both my CSS code and the HTML for my homepage below.

I am seeking assistance in resolving the issue of horizontal scrolling.

CSS:

#navbar {
    background-color: #1A409F;
    position: center;
}

#NavBrandText {
    color: white;
    text-decoration: none;          
    font-style: italic;
    font-family: Helvetica-UltraCompressed;
    letter-spacing: 1px;
    padding-right: 80px;
}

@font-face {
    font-family: Helvetica-UltraCompressed;
    src: url(Helvetica-UltraCompressed.otf);
}

// More CSS code here...

Home Page HTML

<!DOCTYPE HTML>
<html lang="en-AU">
<head>

    <!-- Relevant Meta Tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

    // More HTML code here...

</body>
</html>

Thank you, Pilot640

Answer №1

The issue lies within the footer section. Because the .row element has negative margins on the left and right, it is necessary to add a .container element between the <footer> tag and the .row class.

Answer №2

/* Styling for Horizontal Scrolling */ 
.horizontal-scrollable { 
    white-space: nowrap; 
    position: relative;
    display: flex;
    height: 100%;
    max-width: 100%;
    overflow-y: hidden;
    overflow-x: scroll;
    -webkit-overflow-scrolling: touch;
} 

.h-item {
    background: #f8f9fa;
    margin-right: 4px;
    border-radius: 2px;
    flex-shrink: 0;
    width: 90%;
    max-width: 460px;
    padding: 12px 16px;
}

.h-item:first-child {
    border-top-left-radius: 20px;
    border-bottom-left-radius: 20px;
}

.h-display {
    display: -webkit-inline-box;
    display: inline-flex;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    flex-direction: column;
    position: relative;
    color: #202124;
    vertical-align: top;
}
        <div class="container"> 
            <div class="horizontal-scrollable"> 
                <div class="col h-item h-display">Event Date Time</div> 
                <div class="col h-item h-display">Event Date Time</div> 
                <div class="col h-item h-display">Event Date Time</div> 
                <div class="col h-item h-display">Event Date Time</div> 
                <div class="col h-item h-display">Event Date Time</div> 
                <div class="col h-item h-display">Event Date Time</div> 
                <div class="col h-item h-display">Event Date Time</div> 
            </div> 
        </div> 

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Fixing the mobile display issue with react-responsive-carousel

I am relatively new to ReactJS and I am looking to develop a responsive Carousel. Here is the code snippet that I have currently: To achieve a responsive Carousel for both desktop and mobile devices, I utilized the react-responsive-carousel library. The ...

Ways to create a transparent parallax background

Currently, I'm tasked with developing an educational website using HTML and CSS for a school project. Unfortunately, due to restrictions on code.org, I cannot utilize JavaScript files or script tags. Despite successfully implementing a parallax effect ...

Incorporating Twitter Bootstrap into your Zend Framework 2 Navigation Menu

I have successfully created a menu from my database and the code is functioning perfectly. Now, I'm looking to enhance the menu's style by incorporating Twitter Bootstrap, but I'm encountering some difficulties in doing so. Is there anyone k ...

Modifying HTML Class Names

While engaging in web scraping, I encountered a frustrating NoSuchElement error popping up once every 2 or 3 successful attempts. This was happening even though I knew the element I was looking for was always present. It was a product's name stored in ...

Tips for customizing the CSS file of a React component imported from a UI framework

As I embark on building a large application utilizing React, I find myself navigating the new territory of React philosophy coming from a background of Css+Js+jQuery methods. One key requirement for my project is a reliable UI framework that aligns with Go ...

Display a div upon loading with the help of Jquery

Two divs are causing me trouble! <div id="loader"> </div> and <div id="wrapper"> </div> "The wrapper div is not located inside the loader div just to clarify." This is my code: $(window).bind("load",function() { $(&apos ...

Even when autocomplete is disabled, Firefox continue to cache hidden input fields

I'm encountering an issue with a form that has the autocomplete attribute set to off. Within this form, there is a hidden input element (created using ASP.NET MVC's Html.HiddenFor() method): <input type="hidden" value="0" name="Status" id="S ...

What is the best way to add a stylish border to an iframe?

My attempt to add a border to content on my WordPress site has been unsuccessful. Since I don't know how to add a CSS file, I've been trying to achieve this using what I believe to be HTML. My coding skills are limited to what I learned in high s ...

What methods are available in JavaScript for determining the width of a section and implementing proper spacing for a menu?

Is it possible to use Javascript to dynamically adjust the size of each <li> element within the menuArea so that they fill the entire space correctly? // Could we achieve this with the following code... var menuSpace = Math.floor((menuAreaWidth ...

Repeated HTML/CSS Elements with an Eye-Catching Image Header

I managed to get a header working, but the process was quite unsightly. Is there a more elegant approach to achieving this? My goal is to have a continuous header with an image centered within it. Essentially, I need a repeating background image, with my ...

Ways to move the scroll to the bottom of the div by clicking

Can anyone help with why my scroll code isn't working? I'm trying to make the scroll go to the bottom when I click on $('#openDiv'). For example, when you enter a chat room on stackoverflow, the scroll is automatically at the bottom, a ...

apply CSS to highlight a clicked div as if it were a radio button

Is it possible to use CSS to highlight a div when clicked (when the div is acting as a label for a radio button)? Here is my code: <?php foreach ($images as $image) { ?> <input type="radio" name="id" value="<?php echo $image['id& ...

The image is failing to display in the CSS

As a beginner in the world of CSS and HTML, I encountered an issue where my background image is not showing up. Here's the code snippet that I have: ... <style type="text/css"> #header_contain{ width:935px; height: 135px; ...

Fixing the alignment of the left column table in Bootstrap 3.3.7

Is there a way to fix the left table column (date and all column names) in Bootstrap 3.3.7? I attempted to use position: fixed; but it didn't work as expected. Any suggestions on what I should do next? Check out this fiddle for reference <scr ...

Compatibility of HTML5 websites with Internet Explorer

Following a tutorial on HTML5/CSS3, I meticulously followed each step to create a basic website. While the demo of the site worked perfectly in Internet Explorer 8 during the tutorial, my own version did not display correctly when viewed in IE8. I discove ...

Creating dynamic variable names using JavaScript and constructor: copying an image with EaselJS programmatically onto several canvases

I am facing a challenge with using dynamic variable names in JavaScript within a constructor. This task has proven to be more complex than I initially anticipated. Despite extensively researching this issue on various forums and webpages, I have not been a ...

Include a character on the right side without shifting the text to the left

Below is the HTML code I am currently working with: <div class="last_img"> <p>Galutinė žetono išvaizda:</p> <span class="zetin11">A</span> <span class="zetin12">A</span> < ...

In a responsive layout, a floating div refuses to adhere to the left alignment

I am working on a dynamic list using ASP:REPEATER with floating divs aligned to the left. The current layout is as follows: +---------------------+ +---------------------+ +---------------------+ | | | | | ...

Updating the content of a window without the need to refresh the page using JavaScript

Is there a way to navigate back to the previous window in chat_user without refreshing the entire page when the back button is clicked? Below is the code I have tried: <a href="" onclick="window.history.go(-1); return false;">back</a> ...

Struggling to perfectly align text in the middle of a div container that also has

Seeking help with aligning text vertically within a div that also contains an image. Previous attempts with CSS properties like vertical-align: center; and line-height:90px have proven ineffective. Removing the image allows for the successful use of line- ...