Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Try this:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.slideContainer { overflow-x: scroll; white-space: nowrap; } .slide { display: inline-block; width: 600px; white-space: normal; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="slideContainer"&gt; &lt;span class="slide"&gt;Some content&lt;/span&gt; &lt;span class="slide"&gt;More content. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/span&gt; &lt;span class="slide"&gt;Even more content!&lt;/span&gt; &lt;/div&gt;</code></pre> </div> </div> </p> <p>Note that you can omit <code>.slideContainer { overflow-x: scroll; }</code> (which <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-x" rel="noreferrer">browsers may or may not support</a> when you read this), and you'll get a scrollbar on the window instead of on this container.</p> <p>The key here is <code>display: inline-block</code>. This has <a href="http://www.quirksmode.org/css/display.html" rel="noreferrer">decent cross-browser support</a> nowadays, but as usual, it's worth testing in all target browsers to be sure.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload