tags:

views:

42

answers:

1

Ok, so in the left_col of my page, i have a list UL LI that incorporates a jQuery toggle to open a small box, which is "LoginBox".

<ul>
    <li class="members"><a href="/members/signon.asp?userType=member">Members</a></li>
    <li class="employers"><a href="/employers/signon.asp?userType=employer">Employers</a></li>
    <li class="providers"><a href="#LoginBox" class="clicker">Providers</a></li>
        <div class="loginbox" id="LoginBox">
            <p>Medical</p>
            <p>Dental</p>
        </div>
    <li class="brokers"><a href="/brokers/signon.asp?userType=broker">Brokers</a></li>
</ul>

when the jQuery is invoked, it pushes the elements below it down. As expected. What i dont get is that i have an H3 tag below this UL LI which has a background image. The text portion of the H3 gets pushed down, but the background image seems to stay put, and the UL LI that gets pushed down just covers up the background image of the H3.

why would the text move, but not the background image itself?

here is the H3 style:

    .sectionmenu h3{
    background: url(/_images/h3-triangle.gif) left center no-repeat;
    color: #000;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 0px 4px 10px;
    margin: 0;
    border-bottom:1px dotted #aeaeae;;
}

and the login box style:

    .loginbox{
    display:none;
    width:100px; 
    height:50px; 
    margin:0 0 0 77px;
}
+1  A: 

You cannot have a div in a ul. try changing it to an li

<li class="loginbox" id="LoginBox">
 <p>Medical</p>
 <p>Dental</p>
</li>

The only legal child of ul is li. li can have block elements such as div. I think that once you validate your html, everything will work as expected.

superUntitled
div inside an li should be fine. it just shouldnt be directly a child a of a ul.I can guess this has more to do with padding calculation mix up. If you take all the padddings of and it works then it means it is that. then try to recreate the same layout using margin maybe. or nest the h3 in a div with no padding and margin and create the spaces with only margin on the h3
XGreen
Without seeing an example of his code, I am almost certain that this is an html error and not a css error. In this case, the div is not necessary, and can be changed to a li without trepidation.
superUntitled
@XGreen: That's true, but look at the HTML source the OP provided. The `div` isn't inside an `li`.
S Pangborn
Yes S Pangborn, I stated that as an indication that the markup us correct in the pasted code. So if the rest of it is correct then I can associate it with some similar problems which I have had which was regarding the padding property and its calculation in IE mainly.
XGreen