TechQA.

        Horizontal touch scroll on mobile with text

        2.9k views Asked by frosthammer13 At 2015-06-12T14:08:04+00:00 12 June 2015 at 14:08 2025-12-25T04:39:07+00:00

        I found a solution online that handles horizontal scrolling on mobile devices just fine.

        <div style="max-width: 1024px; margin: auto; ">
           <ul style="white-space: nowrap; overflow-y: hidden; overflow-x: scroll; -webkit-overflow-scrolling: touch; ">
             <li style="display: inline-block; width: 240px;">
        

        The problem that I am having is that within the li tag I have some conditional php echoing out a title. Because of the nowrap the title breaks through the li width. If I remove the nowrap the title is contained within the width limits but the scroll doesn't work. I have used php and js to create line breaks in the text but the scroll still fails.

        Looking for help on this one.

        html css mobile webkit
        Original Q&A
        1

        There are 1 answers

        2
        vinzcelavi vinzcelavi On 2015-06-12T14:31:17+00:00 12 June 2015 at 14:31

        I'm not sure to understand what you would expect to do.

        Why don't you wrap your title in another tag like this:

        <div style="max-width: 1024px; margin: auto; ">
          <ul style="white-space: nowrap; overflow-y: hidden; overflow-x: scroll; -webkit-overflow-scrolling: touch; ">
            <li style="display: inline-block; width: 240px;">
              <span style="display: block; max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
                Your title goes here
              </span>
            </li>
          </ul>
        </div>
        

        Related Questions in HTML

        • How to store a date/time in sqlite (or something similar to a date)
        • How to use custom font during html to pdf conversion?
        • Storing the preferred font-size in localStorage
        • mp4 embedded videos within github pages website not loading
        • Scrimba tutorial was working, suddenly stopped even trying the default
        • Is there any way to glow this bulb image like a real light bulb
        • With non-graphical maps in Leaflet, zoomDelta doesn't work
        • What can I do to improve my coding on both html and css
        • Uncaught TypeError: google.maps.LatLng is not a constructor at init (script.js:7:13)
        • Bootstrap modal not showing at the desired position on a web page when the screen size is smaller
        • Displaying a Movie List on a Website Using Jinja2 and Bootstrap
        • How to redirect to thank you page after submitting a Google form embedded into a Google Site?
        • Storing selected language in localStorage
        • Fences (parenthesis, braces) in HTML and MathML
        • Understanding Scroll Anchoring Behavoir

        Related Questions in CSS

        • How to use custom font during html to pdf conversion?
        • Storing the preferred font-size in localStorage
        • mp4 embedded videos within github pages website not loading
        • Is there any way to glow this bulb image like a real light bulb
        • What can I do to improve my coding on both html and css
        • Uncaught TypeError: google.maps.LatLng is not a constructor at init (script.js:7:13)
        • Bootstrap modal not showing at the desired position on a web page when the screen size is smaller
        • How to increase quality of mathjax output?
        • Hover animation resetting( seemingly reverting back to original CSS and then again to hover)when moving mouse horizontaly accross a part of an element
        • Storing selected language in localStorage
        • How to clip grid cell and provide scroll as well?
        • KeyboardAvoidingView makes a messy the flexbox
        • Rotate an object around another object in javascript
        • Understanding Scroll Anchoring Behavoir
        • how to use only block layout in this css code?

        Related Questions in MOBILE

        • Doesn't work TrafficStats.clearThreadStatsTag() in Kotlin
        • KeyboardAvoidingView makes a messy the flexbox
        • How can I find a lost Samsung Device?
        • How can I eliminate or deactivate the white flash that appears when I press a button via a mobile device?
        • In MAUI how can I Show different appshell tabbars depending on the user role?
        • Why doesn't TrafficStats.clearThreadStatsTag() work in Kotlin?
        • How can I create an animation like WhatsApp archive button spawn animation with SwiftUI on watchOS?
        • Not showing the widget wrapped with Obx in Android 14
        • Is there a way to use Family Link group in my own application?
        • Is it viable proxying all my mobile apps requests, to some kind knowing that a request is coming from a secure source
        • How can I connect android app to arduino via Bluetooth?
        • How to animate calculated position/container height when viewport changes?
        • Unnecessary override. Try adding behavior in the overriding member or removing the override
        • Selecting an option in the mobile app drop down which is not visible when the app is loaded for the first time
        • Getting Real-Time Sensor Data from Smart Watches

        Related Questions in WEBKIT

        • "jumping effect" with sticky position on newer iOS devices
        • Cannot display webkit Inspector in ultralight c++
        • Webkit attributes do not disable/hide AirPlay button in Safari
        • srcset in webkit in xcode
        • Occasional deadlock when keyboard input in WKWebview
        • rotateY() with perspective not rendering correctly on WebKit
        • WKWebView's evaluateJavascript can't access functions in iOS 17
        • Webkit callAsyncJavaScript not waitng for async await function call in SwiftUI
        • antd scrollbar always visibile (problem on firefox)
        • How to input multiple lines in WebKit JavaScriptCore shell?
        • Is there a standard API definition for browser engines?
        • Print HTML (with Images) to PDF in SwiftUI
        • iOS WKWebView's WKProcessPool - when is it safe to share the same process space?
        • Webkit scrollbar issue in mobile?
        • Overlaying Scrollbar Similar to Spotify (Web) Using CSS and/or Javascript

        Popular Questions

        • How do I undo the most recent local commits in Git?
        • How can I remove a specific item from an array in JavaScript?
        • How do I delete a Git branch locally and remotely?
        • Find all files containing a specific text (string) on Linux?
        • How do I revert a Git repository to a previous commit?
        • How do I create an HTML button that acts like a link?
        • How do I check out a remote Git branch?
        • How do I force "git pull" to overwrite local files?
        • How do I list all files of a directory?
        • How to check whether a string contains a substring in JavaScript?
        • How do I redirect to another webpage?
        • How can I iterate over rows in a Pandas DataFrame?
        • How do I convert a String to an int in Java?
        • Does Python have a string 'contains' substring method?
        • How do I check if a string contains a specific word?

        Trending Questions

        • UIImageView Frame Doesn't Reflect Constraints
        • Is it possible to use adb commands to click on a view by finding its ID?
        • How to create a new web character symbol recognizable by html/javascript?
        • Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
        • Heap Gives Page Fault
        • Connect ffmpeg to Visual Studio 2008
        • Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
        • How to avoid default initialization of objects in std::vector?
        • second argument of the command line arguments in a format other than char** argv or char* argv[]
        • How to improve efficiency of algorithm which generates next lexicographic permutation?
        • Navigating to the another actvity app getting crash in android
        • How to read the particular message format in android and store in sqlite database?
        • Resetting inventory status after order is cancelled
        • Efficiently compute powers of X in SSE/AVX
        • Insert into an external database using ajax and php : POST 500 (Internal Server Error)
        • Privacy
        • Terms
        • Cookies
        • Homegardensmart
        • Math
        • Aftereffectstemplates