Dropdown does not show background

Asked

Viewed 26 times

-1

Hello someone can help me with a problem I’ve been facing for a couple of days, my dropdown does not show background without the (overflow-y:auto;) but if I put the overflow the submenu gets together and I want it separated like this. Someone willing to help me?

1 answer

1

I didn’t quite understand your problem with overflow but from what I saw the real problem is to bring up the background of your submenu. this probably occurs because of the stylization used in .down-content see the following example taken from https://codepen.io/andornagy/pen/xhiJH in which overflow is not necessary.

nav {
	margin: 50px 0;
	background-color: #E64A19;
}

nav ul {
	padding: 0;
    margin: 0;
	list-style: none;
	position: relative;
}
	
nav ul li {
	display:inline-block;
	background-color: #E64A19;
}

nav a {
	display:block;
	padding:0 10px;	
	color:#FFF;
	font-size:20px;
	line-height: 60px;
	text-decoration:none;
}

nav a:hover { 
	background-color: #000000; 
}

/* Hide Dropdowns by Default */
nav ul ul {
	display: none;
	position: absolute; 
	top: 60px; /* the height of the main nav */
}
	
/* Display Dropdowns on Hover */
nav ul li:hover > ul {
	display:inherit;
}
	
/* Fisrt Tier Dropdown */
nav ul ul li {
	width:170px;
	float:none;
	display:list-item;
	position: relative;
}

/* Second, Third and more Tiers	*/
nav ul ul ul li {
	position: relative;
	top:-60px; 
	left:170px;
}

	
/* Change this in order to change the Dropdown symbol */
li > a:after { content:  ' +'; }
li > a:only-child:after { content: ''; }
<nav>
        <ul>
            <li><a href="#">Web Design</a>
            <!-- First Tier Drop Down -->
            <ul>
                <li><a href="#">Resources</a></li>
                <li><a href="#">Links</a></li>
                <li><a href="#">Tutorials</a>
            	<!-- Second Tier Drop Down -->
                <ul>
                    <li><a href="#">HTML/CSS</a></li>
                    <li><a href="#">jQuery</a></li>
                    <li><a href="#">Other</a>
                        <!-- Third Tier Drop Down -->
                        <ul>
                            <li><a href="#">Stuff</a></li>
                            <li><a href="#">Things</a></li>
                            <li><a href="#">Other Stuff</a></li>
                        </ul>
                    </li>
                </ul>
                </li>
            </ul>
            </li>
        </ul>
    </nav>

source:

Browser other questions tagged

You are not signed in. Login or sign up in order to post.