Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This can't be done in CSS alone.</p> <p>The example you give (Twitter) has the navbar with fixed position AND fixed size at all screen sizes. Fixed position means that the scrollbars will not affect the position of the navbar, and this is why you can't use the x-scrollbar to see the part of the navbar which, once it's less than 940px wide, is hidden 'under' the right border of the browser window. </p> <p>So you have to choose, either</p> <ol> <li>Have a <em>fixed position</em>, <em>fixed size</em> navbar which is present at the top no matter how far the user scrolls down and accept that under a small enough screen they won't be able to scroll horizontally to see it all, OR</li> <li>Have a <em>fixed position</em>, <em>fluid size</em> navbar which adjusts its width to accommodate different screen sizes, which will hopefully mitigate the need to scroll horizontally in the first place, especially if you let it grow vertically if its contents don't fit in one row, OR</li> <li>Have a <em>non-fixed position</em>, <em>fixed size</em> navbar which will respond to horizontal scrolling but will not be ever-present when the user scrolls down the page.</li> </ol> <p>Effectively, you can't have <code>position</code> work one way in the x direction and another in y.</p> <p>You can see what I mean by option 2 by editing the following classes in the Twitter page using the CSS inspector:</p> <pre><code>.global-nav .container { width: auto; max-width: 865px; } .global-nav, .global-nav-outer { height: auto; } </code></pre> <p>The second selector implements the vertical fluidity for once the contents can't fit in one row.</p> <p>You can see what I mean by option 3 by making these changes:</p> <pre><code>.topbar { position: absolute; /* ... the rest as is */ } </code></pre> <hr> <h2>EDIT</h2> <p>Of course, that it can't be done in CSS doesn't mean it can't be done at all. Here's a jsfiddle implementing that script you mentioned. This uses MooTools as opposed to jQuery, which I normally use with bootstrap.</p> <p>The fiddle: <a href="http://jsfiddle.net/uadDW/4/" rel="nofollow">http://jsfiddle.net/uadDW/4/</a><br> Full screen version to better see the effect: <a href="http://jsfiddle.net/uadDW/4/show/" rel="nofollow">http://jsfiddle.net/uadDW/4/show/</a></p> <p><em>(Thanks to @Sherbrow for providing the base fiddle with which I made this one).</em></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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