Child li dorpdown is not covering width as parent li in navigation


Anybody can help me? Code: https://jsfiddle.net/y57dqa7j/1/ Thanks.

CSS-HTml-Issue-In-Dropdown.jpg


Asked by:- vikas_jk
1
: 10108 At:- 5/29/2017 12:11:14 PM
CSS HTML







1 Answers
profileImage Answered by:- vikas_jk

Correct answer as per Sucia Bogdan

HTML

<nav>
			<ul>
				<li><a href="#">Home</a></li>
				<li><a href="#">About us</a></li>
				<li><a href="#">Our products</a>
					<ul>
						<li><a href="#">Laptops</a></li>
						<li><a href="#">Smartphones</a></li>
						<li><a href="#">Tablets</a></li>
					</ul>
				</li>
				<li><a href="#">Contact us</a></li>
			</ul>
		</nav>

CSS

nav ul {
	
	margin: 0;
	padding: 0;
	list-style-type: none;
	display: table;
	width: 100%;
	border-spacing: 12px;
	table-layout: fixed;
	
}

nav ul li {
	
	display: table-cell;
	background: rgb(0, 71, 115);
	text-align: center;
  position: relative;
	
}

nav ul li a {
	
	text-decoration: none;
	color: rgb(255, 255, 255);
	padding: 12px;
	display: block;
	
}

nav ul li ul {
	
	position: absolute;
	border-spacing: 0;
	width: 100%;
	
	
}

nav ul li ul li {
	
	margin-top: 1px;
	display: block;
	
}

Output will be as required https://jsfiddle.net/y57dqa7j/9/

1
At:- 5/29/2017 12:28:20 PM






Login/Register to answer
Or
Register directly by posting answer/details

Full Name *

Email *




By posting your answer you agree on privacy policy & terms of use