Struggling to hide the scrollbar - having trouble mastering the correct CSS technique

Upon visiting this website, you may notice a horizontal scrollbar. This issue seems to only occur on pages with a comments section, specifically within the

<div id="commentsbackground">
.

I desire to maintain the current style and appearance, while eliminating the presence of the scrollbar.

<div id="commentsbackground">
    <section class="comment">
         <section class="commentsMain"></section>
         <section class="fbcommentbox"></section>
    </section>
</div>

The CSS code is as follows:

#commentsbackground {
width: 6000px;
margin-left: -1172px;
background-color: #EAECF3;
overflow: auto;

section.comment {
height: 500px;
margin-left: 1172px;
margin-top: 20px;

.commentsMain {
width: 500px;
padding-left: 20px;
float: left;
border-right: 1px solid rgba(0,0,0,.13);
padding-right: 20px;
background-color: #E8E8E9;
padding-top: 10px;

.fbcommentbox {
width: 434px;
float: left;
margin-left: 0px;
background-color: #E8E8E9;
padding-left: 15px;
padding-top: 10px;

If I remove margin-left: -1172px; from #commentsbackground and also remove margin-left: 1172px; from section.comment, the scrollbar persists but the white space appears on the left side. Removing width: 6000px; causes the two comment boxes to break and white space to appear on the right side as well.

If I solely eliminate width: 6000px; while retaining the margins, it results in breaking the layout and white spacing on the right side.

Finding a solution has been challenging due to the positioning of

<div id="commentsbackground">
within
<section class="middle_single">
, which has a width of 892px. The challenge lies in maintaining the grey background color of
<div id="commentsbackground">
across all screen resolutions without displaying a scrollbar.

Any assistance would be greatly appreciated.

[EDIT] - Recently, I attempted relocating the entire comment box to the footer.php file just before the footer-bottom div. Although this initially resolved the scrollbar issue, it caused additional problems such as displaying the comments box everywhere, even on pages where comments were disabled via wp-admin settings. Hence, this solution did not prove to be suitable for my needs.

Answer №1

Having a fixed width of 6000 pixels and an offset of a thousand pixels seems absurd. I recommend tweaking the CSS code to eliminate this issue, as it worked for me.

Eliminating the scroll bar may cause elements to overlap due to excessive width.

.commentsbackground { margin-left: 0; width: 100%; }
.comment { margin-left: 0; }

To resolve this, consider reducing the size of the right column to allow comments and form to be displayed side by side.

.fbcommentbox { width: 335px; }
<span style="height: 200px; width: 335px;"></span>
<iframe width=335>

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

Is there a way I can invoke my function prior to the form being submitted?

For the last couple of days, I've been struggling to make this code function properly. My goal is to execute a function before submitting the form to verify if the class for each variable is consistent. You can access my code here. Any assistance you ...

Wrapping Text around an Image in HTML

I am currently in the process of designing a website using the flexible box model. My main challenge right now is trying to align text to the right of an image, and then below it. I've attempted using float:right/left along with align="left/right", bu ...

Leveraging perl's CGI.pm within various subroutines

I am currently working on a school project that requires me to write a Perl CGI script to build a social networking site. While I have successfully created multiple subroutines for different pages, I am encountering an issue. When I try to execute each su ...

removing functionality across various inputs

I have a JavaScript function that deletes the last digit in an input field. It works fine with one input, but not with another. It only erases the digit in the first input. <script> function deleteDigit(){ var inputString=docu ...

Is it possible to include both the value and text of a dropdown in form.serialize?

For my project, I need to serialize the form data. However, when it comes to dropdowns, only the values are captured and not the text of the selected option. <select name='attend'> <option value="1" selected="selected">Question&l ...

Switching carousel background image upon navigation click

I am currently working with a Bootstrap Carousel and I want to customize the background (an image) for each slide. I have 4 slides in total, each corresponding to a specific background image. <!DOCTYPE html> <html lang="en" dir="ltr ...

Unable to set items as sticky within mat-tabs

Is there a way to make my image stick in place using the following CSS code? position: -webkit-sticky; position: sticky; top: 1px; I have tried implementing it but haven't been successful. HTML: <mat-tab-group class="user-tabs" (selectedTa ...

When the CSS animation has finished in JavaScript

I am currently developing a game using HTML/JavaScript, and I have implemented a "special ability" that can only be activated once every x seconds. To indicate when this ability is available for use, I have created a graphical user interface element. Since ...

I'm having trouble applying JavaScript to my Flask template, even though it is stored in the static directory. Any suggestions on how to fix this issue with the code provided?

I am currently working on a Flask project and attempting to create a hierarchical structure resembling a tree. However, I suspect that the JavaScript is not being correctly applied to my tree.html file, as the options cannot be expanded. The code provided ...

Styling Forms with SPAN Text in Place of Input or Select Controls

My current CSS is specifically designed to format labels above form input elements, but I am facing an issue when trying to replace the inputs with text from a database for displaying read-only data. Despite my efforts, changing the input fields to a span ...

``There seems to be an issue with the alignment of items in the

I am fairly new to using css and bootstrap and I am currently working on integrating a carousel into my angular web app. I copied the code from the bootstrap site but I am facing challenges in aligning everything properly. Additionally, the image slides do ...

Vertically center the container

I am struggling to center my container div vertically, similar to how it is horizontally aligning with margin: auto;. Despite searching online for solutions, I have not been successful in finding a method that works for me. It is surprising to me that in t ...

Expanding Vue Tabs with Bootstrap: Manipulating tab-content to perfectly fill parent height

On my webpage, I have implemented a tabs component called b-tabs. This component is enclosed within a parent div with a specific height. I am trying to make the content of the tabs take up the full remaining height of the parent component. https://i.ssta ...

Centered Fixed Upward Scrolling Div

Currently facing a challenge with my project involving a chat interface created in Angular. I am struggling with the CSS styling as the chat starts at the top and scrolls downward off-screen as the conversation progresses. Although I can scroll along with ...

What methods can be used to prevent the appearance of the ActiveX warning in IE7 and IE8 when dealing with drop

I have a dilemma with my website where I am using JavaScript to modify CSS on hover for specific items. Interestingly, in Firefox everything runs smoothly without any ActiveX message popping up. However, in IE8, I encounter a warning stating "To help prote ...

Screen resolution in HTML refers to the number of pixels

I am facing an issue with pixel positioning on my web page. I have a cover image set as the background of the body and a button placed on top of it. However, when the page is resized, the button moves along with it. I want the button to remain in its ori ...

Updating the Mat Table Label Dynamically in Angular

Is there a way to dynamically change the value of a label in an Angular mat table with pagination without recreating the entire table? The goal is to update the header label without having to regenerate the whole table structure. For instance, in the tab ...

"Enhance Your Online Shopping Experience with Woocommerce Ajax Filters and

I have a structure that looks like this: Company Google Apple Microsoft Material Wood Metal Plastic Essentially, Brand & Material are attributes in the Woocommerce system, while the rest are variables. I am currently working on implementing AJAX fi ...

Rewriting Rules for WordPress site on Apache Server

Looking to redirect Facebook crawlers to a static page on my AngularJS website due to the need to work with og:meta. Using Wordpress as the back-end, currently utilizing the following .htaccess: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngi ...

How to style the second child div when hovering over the first child div using makeStyles in Material UI

I am working on a web project with a parent div and two child divs. I need to apply CSS styles to the second child div when hovering over the first child div. Below is the structure of the render method. <div className={classes.parent}> <div c ...