简体   繁体   中英

DropDown place in top of other element css

I tried putting a dropdown but hes not on top of other elements. I tried puting z-index but still no luck. I've make the position: 'relative' but the element got pushed down when hovering on the dropdown button.

heres the site http://jaysonvelagio.webprodigymedia.com/

<div id="believe-belong">
    <div class="site-width">
        <div class="two-col">
            <div class="two-col-one image">
                <img src="assets/image/dine.jpg" alt="CLICKTREP Dining Privileges" />
            </div><!-- .two-col-one.image -->

            <div class="two-col-two">
                <h3 class="green">Dine</h3>
                <p>Taste your favorite mouthwatering dish for less on restaurants/Café/Bakeshop of your choice all over the Metro. Take advantage of the regular discounts and perks whenever you visit our partners.</p>
                        <div class="dropdown">
                          <button class="dropbtn">partners in dine</button>
                          <div class="dropdown-content">
                            <a href="#">Link 1</a>
                            <a href="#">Link 2</a>
                            <a href="#">Link 3</a>
                          </div>
                        </div>  
            </div><!-- .two-col-two -->
        </div><!-- .row.two-col -->

    </div><!-- .site-width -->
</div><!-- #believe-belong -->


<div id="gray-back">
    <div class="site-width">
        <div class="two-col" >  
            <div class="two-col-two">
                <h3 class="green">Shop</h3>
                <p>Instant Discounts anytime from today’s best Shopping stores. <br>Like Toby’s Sport, RUNNR, Ideal Vision and a lot more. </p>
                <a href="clubmembers/blog.php" class="button">Partner Stores</a>    
            </div><!-- .two-col-two -->
            <div class="two-col-one image">
                <img src="assets/image/shop.jpg" alt="CLICKTREP Dining Privileges" />
            </div><!-- .two-col-one.image -->       
        </div><!-- .row.two-col -->

    </div><!-- .site-width -->
</div><!-- #believe-belong -->

I had a play with your code in the website and seems your issue is a bit more complex to solve than you think.

The reason you won't get that dropdown is that you have overflow:hidden on the parent div with class two-col .

Now if you try and add overflow:visible to that it messes with the whole DOM structure as you can see:

在此处输入图片说明

The only way you can fix this is to add overflow:visible to your div and see how you can rearrange the structure.

UPDATE:

I had another play with it with only adding overflow-y:visible . This time it doesn't mess with the UI but adds a scrollbar to that div. If that's OK you can proceed with this one.

.two-col {
   overflow-x: hidden;
   overflow-y: visible;
   position: relative;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM