2

I have a horizontal drop down CSS menu at http://www.stevemoorecpa.dreamhosters.com/

My problem is the menu width extends outside the site's wrapper and I cannot get it to hide.

Example of problem

How do you prevent the element from going outside the site wrapper? Here is the code for the wrapper...

#wrapperSkm {
    border-left-style: solid;
    border-right-style:solid;
    border-width: 2px;
    border-color: transparent;
    -moz-box-shadow: 0px 0px 25px #c3c3c3;
    -webkit-box-shadow: 0px 0px 25px #c3c3c3;
    box-shadow: 0px 0px 25px #c3c3c3;
    width:1069px;
    overflow: hidden;
    padding: 0 0px 0 0px;
    margin-left: auto;
    margin-right: auto;
    background:url(images/line1Right.png) repeat-x right 134px;
}

And here is the code for the horizontal sub-menu navigation

#access ul ul {
    display: none;
    float: right;
    margin: 0;
    position: absolute;
    top: 181px;
    left: 0;
    width:100%;
    background:#fff url(images/line1Nav.png) repeat-x bottom;
    z-index: 99999;
    text-align:center;
}

I've been working at this all day and nothing will get the menu to hide it's overflow outside the main site wrapper.

All help is appreciated.

1 Answer 1

5

HI now add position relative in your wrapperSkm ID

as like this

#wrapperSkm{
position: relative;
}

result is

enter image description here

Sign up to request clarification or add additional context in comments.

4 Comments

Is there an article or something that explains why this works? That is, how overflow: hidden and position: relative work together?
Wow I should have asked this days ago. I couldn't find my error. Thank you so much.
@TomSmilack An absolutely positioned element is positioned relative to the first parent element that has a position other than static applied to it. vanseodesign.com/css/css-positioning , that's why position: relative is likely (or ALWAYS ;) ) to be set on a parent of an absolutely positioned element. overflow: hidden is another beast (and I tend to avoid it most of the time as it'll bite me later in most projects). It creates a Block Formatting Context (reliable source: T. Koblentz)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.