Ways to activate side-to-side scrolling?

Here on this specific page, I am looking to showcase the SPECIAL and RECOMMENDED sections together in a single line with horizontal scrolling.

This is my current CSS:

.box-product {
width: 100%;
overflow: auto;
} 

I have attempted implementing it like this:

.box-product {
width: 100%;
height: 320px;
overflow-x: scroll;
overflow-y: hidden;
}

However, this method has not successfully enabled the horizontal scroll; the vertical scroll still appears.

Answer №1

Adjust the width of .box-product to be equal to the product width multiplied by the product count. No other changes are necessary.

Currently, the width is set to 100% (737px), causing the content to break to a new line due to default CSS behavior. Adding overflow: hidden will hide the second line of content.

Answer №2

Enter the width of your box-product class in pixels, not as a percentage. Then, apply overflow:auto.

This method will be effective.

Example: .box-product { width: 100px; overflow: auto; }

If you only want horizontal overflow, add overflow-x:auto;

Answer №3

To effortlessly accomplish this, simply use the following CSS rule:

.box-product { width: max-content; }
(with consideration for vendor prefixes).

Another option is to utilize display: flex, as its children do not automatically wrap.

Answer №4

Get rid of the width: 100% property and ensure that your content is not floating.

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

How do I apply a xPage page style using the styleClass attribute instead of directly using the style attribute

Would like to know how to change the background color of an entire page using styleClass instead of directly in the xp:view tag? Here's an example that works: <xp:view xmlns:xp="http://www.ibm.com/xsp/core" style="background-color:#f1f1f1;"> ...

What are the specifications for the opacity, width, and height of the background image in Bootstrap's

My current project has specific requirements that I need assistance with: I need the background image of the jumbotron to fit the width of the page and have its height scaled proportionally. The opacity of the jumbotron's background image should be ...

The PHP login form must be submitted twice

I've encountered an issue that's stumping me. All of my other forms are functioning correctly, except for the Login Form, which needs to be filled out twice before it works. First, I input my username and password, submit the form, and the page ...

Can someone explain what logForm.$invalid.$setValidity is all about?

The code snippet can be found here I am a beginner in this field and currently studying a piece of code. I am having trouble understanding the logForm.$invalid.$setValidity line. I have searched online but couldn't find any information about it. The ...

I plan to add new information to my table only when the user clicks on the submit button. This is what I have accomplished until now

<!DOCTYPE html> <html> <head> <title>Sign up page</title> </head> <body> <form method="get" action="signup_redirect.php"> username: <input type="text" name="username" placeholder=" ...

Is there a way for me to insert PHP code into a file that has been generated by PHP?

I have encountered an issue where PHP files seem to convert all PHP code into emptiness. Despite creating a PHP file, adding PHP and HTML code to it, and then closing it, the code does not appear as expected in the file. I attempted a solution which is det ...

Is your Bootstrap button displaying a blue border?

Recently, I incorporated buttons into my website using a bootstrap template. However, after customizing the button colors, I discovered an annoying blue outline appearing around each button. Despite numerous attempts, I have been unsuccessful in eliminatin ...

Updating React JSX class based on certain conditions without manipulating the actual DOM

When working with jsx react, I am looking to dynamically set a class while keeping another class static. Here is an example of what I would like to achieve: maintaining the type class and having an additional dynamic class change change to either big, smal ...

Raise the image above the wrapping div, positioning it at the very bottom

I'm struggling to position an image within a div in a way where: it protrudes above the div it begins at the very bottom of the div (with a small gap that I can't eliminate) Below is the relevant HTML code snippet: <div class="teaser-imag ...

Intriguing flashing dark streak, reminiscent of a boundary within NextJS

I have recently encountered an unexpected issue with my full-width video header that worked perfectly on multiple pages before. Strangely, a thin black line has appeared around the bottom and right side of the div (.header) containing the video, even thoug ...

Click on the link to return to the previous page on the website

As I work on customizing a Tumblr theme, I find myself facing a few challenges. One such issue is my desire to include a link on post pages that directs users back to the previous page, similar to what is shown in this image: picture1 I have attempted var ...

Ensuring a consistently positioned footer at the bottom

I understand that this might not seem like a significant issue, but I'm encountering some difficulties. In my main.html file, there are three divs. The first div contains the navigation bar, the second div is an "empty" div that uses JQuery/Javascript ...

Accessing cell values within a table using JavaScript

I am having some trouble with extracting unique IDs from the input text areas in the first column of an HTML table. These IDs are dynamically assigned using JavaScript. Can someone help me with this issue? Below is the HTML code for my table: <table id ...

Is it possible to loop through a directory containing images and dynamically generate a CSS rule that positions each image based on its

I'm not very familiar with PHP so I could use your expertise in coming up with the most efficient and straightforward solution for this specific task. In my directory "path/images/headers," I have multiple header images all cut to the correct size, ea ...

What method does nosotroshq.com use to achieve the navigation effect when hovering over a menu item?

Seeking advice from skilled individuals familiar with JQUERY: Can anyone explain the technique used by nosotroshq.com in their top navigation bar? Specifically, how do they create the slow animation when hovering over "ABOUT US"? Any insights would be ap ...

Snap to the top of the table with merged columns using scroll feature

I am currently attempting to create a table with horizontal scrolling and snapping behavior for the yellow header columns that span multiple columns. These headers should snap to the end of the red column, while always maintaining alignment at the beginnin ...

JavaScript: Controlling the ability to enter text based on the chosen option from a drop-down menu

After struggling to make my code work, I decided to create a piece of JavaScript to disable a text input when "Cash" payment is selected from the dropdown menu. On the contrary, I aimed to enable the text input if "Credit Card" payment was chosen. Unfortun ...

What is the method to create a resizable table column border rather than resizing the bottom corner border?

At the moment, we are able to resize the table border when we drag the corner. However, my goal is to enable resizing on the right side of the full border. Below is the CSS code for resizing: th{ resize: horizontal; overflow: auto; min-width: 100px! ...

"Position centrally on the inside, using flexbox to fill the entire

Seeking assistance with aligning the text in the center of the flexboxes so that the h4 and p elements in the large box are centered within their respective boxes, as well as ensuring the text in the two smaller boxes is also centered. Any help would be gr ...

The placeholder text in the matInput field is not being displayed

As a newcomer to Angular, I am facing a challenge that has left me unable to find a solution. Below is the code snippet in question: <mat-form-field> <input matInput placeholder="ZIP" style="color:red;"> </mat-form-field& ...