Matt Elhotiby
Matt Elhotiby

Reputation: 44066

Why is the dropdown pushing down the lower div

I have this page and if you scroll to the middle you will see a Select Shipping Method dropdown and if you click on it. It will push the Review Terms & Conditions link down...here is my code

HTML

<div class="shipping-box lf">
<div class="ship-box1 lf">
    <div class="sel-ship lf">
        <div class="ss lf">
            <span class="lf">Select Shipping Method</span>
            <a class="ship-btn" href="#"></a>
        </div>
        <div class="dropdown lf" style="display:none;">
            <ul>
                <li class="ss-1 lf">1 Location</li>
                <li class="ss-2 lf">2 Location</li>
            </ul>       
        </div>  
    </div>
    <div class="terms lf">Review Terms & Conditions</div>
</div>

CSS

.shipping-box {
    height: 65px;
    padding-top: 0;
    position: relative;
    width: 700px;
}

.lf {
    float: left;
}

.ship-box1 {
    width: 220px;
}

.sel-ship {
    width: 220px;
}

.terms {
    color: #009900;
    font-family: "helvetica neue";
    font-size: 12px;
    padding-left: 20px;
    text-decoration: underline;
    text-transform: uppercase;
    width: 200px;
}

JQUERY

$('.ship-box1, .ship-btn').click(function () {
    $(this).parents('.sel-ship').find('.dropdown').slideToggle();
    $(this).parents('.ss').toggleClass('ship-btn:hover');
    return false;
});

Any ideas on how to make sure the terms link stays in place

Upvotes: 1

Views: 569

Answers (3)

peduarte
peduarte

Reputation: 1677

This will fix it for you:

.sel-ship { position: relative; }
.dropdown { position: absolute; top: 25px; }

Upvotes: 2

Samich
Samich

Reputation: 30115

Set for .sel-ship class position:absolute;, for .terms class set margin-top:35px;

Upvotes: 1

Andy
Andy

Reputation: 30135

Try adding this:

.sel-ship{
    position:absolute;
}
.terms{
    margin-top:30px;
}

Upvotes: 1

Related Questions