Welcome to WebmasterWorld Guest from

Forum Moderators: not2easy

Message Too Old, No Replies

Horizontal scrolling crops left and right

How to accomplish this?

12:48 am on Dec 13, 2011 (gmt 0)

New User

5+ Year Member

joined:Dec 13, 2011
posts: 2
votes: 0

This page,


crops both the menu bar and main photo on the left and right as the browser window is narrowed. No horizontal scroll bar appears until the browser window impinges on the text even though the menu bar and photo extend beyond the window width. Anyone know how this is accomplished? Thanks!

(I am not sure if this is a css question. If not, please refer me to the correct forum category).
2:49 am on Dec 13, 2011 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
votes: 599

How much of the code did you look at?

:: detour to add some desperately needed spaces and line breaks ::

Ignore all the jquery and conditional yakkety-yak. The text is a red herring: Every one of those items has an explicitly declared width to go with the embedded font. (Baaaaad Arkansas! :)) Incidentally, it's a list.

The answer is here:

#mainNav {position: absolute; top: 217px; left: 50%; z-index: 1000; width: 976px; margin: 0 0 0 -488px}

That's all.

50% = guess what relationship to -488px and 976px.

Try it and see. Put in a visible border and fill with some meaningless text and watch it happen before your very eyes. You can do it with ems too. The image is background and therefore has no effect on the page scrolling.
6:35 am on Dec 13, 2011 (gmt 0)

New User

5+ Year Member

joined:Dec 13, 2011
posts: 2
votes: 0

Very cool and thanks. It worked on the first try.
9:49 am on Dec 13, 2011 (gmt 0)

Senior Member from GB 

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 2, 2003
posts: 998
votes: 32

Hi there jeffz,

this would be the the normal way to code your example...

<html lang="en">
<base href="http://www.arkansas.com/!userfiles/mp_core/">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="language" content="english">
<meta http-equiv="Content-Style-Type" content="text/css">


<style type="text/css">
body {
#container {
border:1px solid #000;


<div id="container">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec
ultricies sollicitudin nisi, ut molestie felis adipiscing sit
amet. Sed auctor vehicula commodo. Nam a nibh neque, vitae
faucibus felis. Vivamus at metus eget eros consequat fringilla.
Quisque magna magna, laoreet eu tempus sit amet, fringilla at
tellus. Praesent felis tortor, scelerisque vitae fringilla
non, porttitor et lacus. Ut ut sapien nec quam tincidunt
consectetur in nec lacus.
Phasellus porta, dui a elementum egestas, odio sapien rhoncus
lorem, vitae bibendum erat sem eget sapien. Maecenas ut metus
ac quam pellentesque lacinia quis sit amet augue. Fusce eu
euismod urna. Nunc volutpat scelerisque tempus. Donec eget arcu
et mauris scelerisque tristique. Donec fringilla mauris dolor,
sit amet vulputate lacus. Nulla feugiat mattis nulla non
tincidunt. Nam sit amet dolor eros, a viverra lacus. Nunc quis
nisi eget neque tempus facilisis eu quis sapien.
Ut et metus a massa rhoncus cursus. Integer luctus luctus enim,
tristique rhoncus enim feugiat eu. Etiam porttitor volutpat
massa sed congue. Sed eros nisl, volutpat ac dapibus quis,
ultricies id diam. Mauris at elit eget quam ullamcorper sagittis
ac vel lorem. Ut nec justo libero. Phasellus eget pharetra elit.
Proin viverra, neque non eleifend vehicula, nulla augue gravida
felis, non fermentum lorem odio ac nunc. Aliquam pretium
scelerisque consectetur. Proin ultrices urna non magna interdum
a sodales turpis suscipit. Mauris sollicitudin nisl ac arcu
sodales cursus. Maecenas bibendum neque vitae orci mollis ac
vulputate ante auctor. Sed sodales odio id ante sagittis faucibus.