The horizontal scroll feature is malfunctioning on Overflow

I'm attempting to conceal internal nested elements inside a main container, in order for the container to scroll horizontally and reveal the hidden elements. You can view an example on this JSBin link.

.wrapper {
  position: relative;
  width: 150px;
  height: 20px;
  overflow-x: scroll;
  overflow-y: hidden;
  border: thin dotted;
}
span {
  margin: 0 10px;
  display: inline-block;
}
<section class="wrapper">
  <span>One</span>
  <span>Two</span>
  <span>Three</span>
  <span>Four</span>
</section>

Answer №1

To ensure the text does not wrap, simply include white-space: nowrap in the .wrapper CSS class.

.wrapper {
  width: 200px;
  overflow-x: scroll;
  border: thick solid;
  white-space: nowrap;
}
span {
  padding: 0 15px;
}
<section class="wrapper">
  <span>First</span>
  <span>Second</span>
  <span>Third</span>
  <span>Fourth</span>
</section>

Answer №2

consider using overflow-x: auto; in place of overflow-x: scroll;

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

Prevent the display of hyperlinks in the status bar when hovering over a hyperlink or button

The application I'm working on has a default status bar at the bottom of each screen that displays URLs linked to buttons and icons. For example: https://i.stack.imgur.com/ZFTsp.jpg I am trying to prevent the display of URLs associated with hyperlin ...

A few of the input fields I filled out are not getting sent to the PHP script

Currently, I am working on a school project that involves creating a website similar to IMDB. My task is to include comments in our database, but I am facing an issue where two fields (fid and spoiler) are not getting posted to the PHP script handling the ...

Icons that are clickable in ionic

I have successfully created a list card with 2 icons in each row. However, I am facing a challenge in making these icons clickable without disrupting the layout of the list. I attempted to add an ng-click to the icon element, but it did not work as expecte ...

Is there a way to position the nav menu outside of the navbar without it overlapping?

After spending 4 hours trying to solve this problem, I've hit a roadblock. I'm attempting to create a responsive menu where the dropdown appears below the navbar when the hamburger menu is clicked, instead of overlapping it like in the current sn ...

I can't seem to figure out why the removeChild() function is not functioning properly in my

Recently, I've been working on a search website where users can input either a partial or full name and then click a button to display a list of actors whose names contain that specific string in a hint-like fashion. These names are sourced from a MyS ...

Modify the class of the dropdown and heading 2 elements if they meet specific conditions using Animate.css

Is it possible to add a class using jQuery when two specific conditions are met? 1) If the dropdown selection is either "acting" or "backstage" 2) If the membership status is set to "Non-member" If both of these requirements are fulfilled, I would like ...

What is the best way to adjust the size of a form element to be 600px wide only when the window width exceeds 600px?

As part of the application process for a coding bootcamp, I have been asked to complete an HTML/CSS assessment. After submitting my code, I received feedback stating that there was no 'form' element set to 600px when the window width exceeded 600 ...

The loading cursor in IE7 flickers incessantly, causing the webpage to lag and become un

When I move my cursor and click in text fields, the page becomes unresponsive and shows a wait cursor. If you're curious to see this issue in action, check out this video. This problem is specific to IE7. I've attempted to identify any ajax re ...

What is the best way to position a button to the right of a textarea?

I am facing an issue with my website that uses Bootstrap 4. The contact form in my design is beautifully aligned, but on my actual website, it appears misaligned. I have experimented with floats and tried organizing the form elements in rows and columns, b ...

The flotation table gracefully drifts within the confines of the hidden container

My goal is to display two tables on the same line. To achieve this, I am using the code float: left;. You can see an example of this in action here. If the width of those tables exceeds that of the container, I apply overflow: hidden; to hide the excess c ...

Function call fails when parameters are passed

I've been grappling with this conundrum for a few weeks now, on and off. Perhaps someone else will spot the glaringly obvious thing that I seem to be overlooking. At the present moment, my primary goal is to simply confirm that the function is operat ...

Customizing the appearance of Twitter Bootstrap based on the AngularJS input class $invalid

I'm struggling with getting error messages to display properly in my Bootstrap form when using AngularJS. I followed the instructions on this link: but I still can't figure out what I'm doing wrong. Any advice? Thanks <div class=" ...

What causes the unusual behavior of css property "all: unset" in the Safari browser on MacOS?

Here's the situation - the parent element has the CSS property all: unset. I noticed that in Safari (Version 12.1.1 (14607.2.6.1.1)), all the children of this parent are only affected by the * selector, ignoring inline styles and even the !important ...

Sending data via Ajax using the multipart/form-data format

I am encountering an issue with a script that is not working correctly. When I submit the form without using the script, everything works as expected. However, when I use the script to submit the form, only the category and description are included in the ...

Achieving responsive design using text font percentage instead of text images can be done by implementing the following code snippet provided below

When working with text in HTML, I encountered an issue where using percentages for width and height was not giving me the desired results. To work around this, I used images of text instead, but each image ended up either stretched or looking too small. H ...

Guide on incorporating `Animate.css` into an Angular application

I've been attempting to implement the bounceInUp animation from animate.css on a div upon showing it, but I can't seem to get it to work. What am I doing wrong? Can someone guide me on the correct way to achieve this effect? This is my CSS code ...

Using the overflow-y property with a value of auto will hide any content that

I'm attempting to create a scrollable container for cards where the scrolling is restricted to the card content only, excluding the header and footer. My assumption is that the container should hide horizontal overflow and each card should have overfl ...

Can CSS be used to show text at a descent rather than baseline?

Is there a correct method to position text at the descent height of a line rather than its baseline? For more information, please visit: http://en.wikipedia.org/wiki/Baseline_(typography) and http://jsfiddle.net/YPPnU/ The objective is to align the bo ...

Guide to achieve the Detail view of a Bootstrap HTML form in Codeigniter after submitting

Recently, I encountered an issue with my bootstrap form. After successfully inserting data into the database, I wanted to display a detailed view of the form with the filled data. However, upon submission, it kept redirecting me back to the create view ins ...

The functionality of Div.Show is not consistent while the code is running, yet it operates smoothly when the code is

When I trigger a save action, a hidden div is supposed to appear. The structure of this div is like so: <div class="Working" style="display: none;">Message</div> As part of the save process in my code, the following logic is implemented: fun ...