My live website is plagued by an annoying horizontal scroll bar that doesn't appear in the local host version

I am struggling to remove the unwanted horizontal scroll bar on my live website, although it is not visible on my local host... <-- this is my website, built using Vite + ReactJs. I attempted to use overflow: hidden; and max-width: 100% on the body tag, but unfortunately, it was unsuccessful... NOTE: This site is a new project and still under development, hence not yet optimized for responsiveness.

All I want is to eliminate the undesired scroll bar from my live site.

Answer №1

Yes, I encountered a similar issue. The solution may vary depending on your screen resolution. Try opening your developer tools in a separate window and resizing your main window to see if a horizontal bar appears at a specific resolution.

I decided to investigate further by using Chrome Devtools and examining different elements on the page. It became apparent that the upper right section was extending off the screen to the right and appeared wider than other elements.

Upon closer inspection of the image named "hero.gif", I discovered that the width of the class "heroGif" was set to 55%:

By manually adjusting the width to 50%, I was able to eliminate the scrollbar. However, this adjustment caused the aspect ratio of the image to become distorted (similar to when it was set at 55%). Remember that setting the width and height % for an image is based on the container size. If you only adjust one parameter, the aspect ratio will remain intact and the image will scale correctly. I would recommend keeping the height % and removing the width %. Keep in mind that this change could impact other areas where the same class is used, so thorough testing is necessary.

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

What is the best way to handle HTML files that have the same name as folders?

I am looking to incorporate a News section on my website with the unique URL: mysite.com/news Each news article should be stored in a specific folder named "News" like this: mysite.com/news/2021 However, when I attempt to access the news.html file (witho ...

Just starting to learn jquery and I'm struggling with this code, can someone help?

I am trying to move the .icon element to the right and animate it based on its position().left value. Unfortunately, my code is not working as expected and I can't figure out why. It seems like such a simple task! <script> $("li.menu-item").ho ...

Tips for setting up a personalized preview mode in Sanity Studio using Next.js

I am facing an issue displaying the preview mode because the URL must contain specific parameters such as "category" and "slug" (as shown in the image below). Here is the error URL with undefined parameters Therefore, I am unable to retrieve the paramete ...

When viewed on a mobile device, the entire HTML document is resized to occupy less than half of the

Whenever I adjust the size of my webpage on different devices or mobile phones, I notice that the <div> tag appears to be only half (or even less) the width of the page. This gap seems to increase as the window size decreases. Refer to the screenshot ...

Navigational Scroll Parallax Issues

I have been trying to implement a basic 2 layer parallax effect using ScrollMagic on my index page. The layout consists of a large image with content below it, but I am facing some challenges. Despite going through the documentation and source code multipl ...

Is it advisable to replace component state with global state in Redux?

I am contemplating whether I should continue using stateful React components or transfer that state into the Redux store. What would you suggest? ...

Encountering 503 errors with Heroku while making asynchronous API calls in my React application

Almost at the finish line with my project! The coding part was a breeze, but deployment is proving to be quite the nightmare. I've managed to get most of it deployed, but now the app is experiencing timeouts on API calls, even though they work perfect ...

What is the mechanism through which a nested function within an event handler obtains the event object?

How is the e object available to the nested function inside handleClick2 when only the input object is passed? Is this related to the concept of Lexical Environment? handleClick2 = (input) => (e) => { this.setState({ [input]: e.target.va ...

Looking to rearrange the location of the React Material-UI DataGrid filter menu popup?

I successfully integrated React Material-UI DataGrid with a filter in the toolbar. When the filter menu/popup opens, it covers the first few rows of the grid/table. Instead, I would like this popup to open at the top-start position rather than bottom-star ...

Issues with CSS Modules not applying styles in next.js 13 version

Employing next.js 13.1.1 along with /app Previously, I had been handling all of my styles using a global.css, however, I am now attempting to transition them into CSS Modules. Within my root layout.js, there is a Header component that is imported from ./ ...

Box size adjusts to fit its content, including any form fields

Looking to create a box that adjusts its size based on content and center it without resorting to using tables for layout or setting fixed sizes. How can this be achieved while keeping the markup clean? I've almost got it, but the form fields are not ...

Having difficulty bringing in personalized fonts

I've recently created a nextjs app and I'm encountering an issue - I can't seem to import custom fonts. I attempted adding ttg files and using @fontface, but the fonts aren't displaying correctly. Can someone please assist me? Below is ...

Achieving success with the "silent-scroll" technique

I've been struggling to implement the 'scroll-sneak' JavaScript code for quite some time now. This code is designed to prevent the page from jumping to the top when an anchor link is clicked, while still allowing the link to function as inte ...

"The application is experiencing issues with loading styles correctly when using jQuery append (Fiddler has been

When attempting to load a div tag using the .append() method, the styles are not loading correctly. Here's the code that was tested: <section id="year-2020" class="tab-panel"> <div class="row accordion"> <header> ...

Utilizing a dynamic URL to set the background image of a div element (with the help of

Currently, I am in the process of designing a user registration page that allows users to input an image URL and view a preview of the image within a designated div. The div already contains a default image set by a specific class. The HTML code for displa ...

Saving props in React-select

I'm currently utilizing react-select to enable multiple selection on my UI. However, I need to extract the props from react-select since I will be sending the selected values to the backend. My query is how can I store the state values in an array for ...

The animation of a disappearing div with CSS is not stopping when hovering over it

Hello, I've been working on a snackbar feature that appears and disappears on a set timer but also needs to pause when hovered over. Unfortunately, the current setup with setTimeout and useState is causing issues with this functionality. I have looke ...

How to align 3 buttons in a div using CSS

My design has 3 buttons that I want to always remain centered on the page, but they seem to skew off-center as the window widens (as shown in the image). What HTML/CSS code can I use to ensure that these buttons are perfectly centralized at all times? It ...

Guide to creating a React session with Axios:

Managing people with authentication/authorization using a Nest backend and session. Postman working fine, important bits are the Interceptor and Guard: Guard.ts canActivate(context: ExecutionContext) { const request = context.switchToHttp().getReques ...

Custom time selector does not automatically set the default value

After creating two inputs where one represents hours and the other minutes, clicking on edit should display the total time in seconds. The original time for editing should remain unchanged until you choose to save it. Here is the link to the code: https:// ...