html - Submenu with full screen width -
i have top menu submenu listing images , slider. submenu extend background full screen , content goes center align. can't not changes in html structure. have try set submenu it's not showing full screen. here screenshot.
here fiddle link
below code:
header { border-bottom: 1px solid #000; } .menu { margin:0; list-style: none; padding: 0; } .menu li { float: left; } .menu li .submenu{ display: none; } .menu li { color: #000; padding:10px; text-decoration: none; display: block; text-transform: uppercase; font-weight: bold; position: relative; } .menu li a:hover{ color:#999; } .menu > li > a::before { border-left: 13px solid transparent; border-right: 13px solid transparent; border-top: 13px solid #fff; bottom: -13px; content: ""; display: none; height: 0; left: 50%; position: absolute; transform: translatex(-50%); width: 0; z-index: 2; } .menu > li > a::after { border-left: 13px solid transparent; border-right: 13px solid transparent; border-top: 13px solid #000; bottom: -14px; content: ""; display: none; height: 0; left: 50%; position: absolute; transform: translatex(-50%); width: 0; z-index: 1; } .menu li:hover a::before, .menu li:hover a::after { display: block; } .menu li:hover .submenu { display: block; } .submenu { background: #ebf2f2; left: 0; min-height: 300px; padding: 24px 30px 36px; position: absolute; text-align: center; top: 41px; transition: 0.3s linear 0s; } .submenu ul li { display: inline-block; float: none; line-height: 1; margin: 0; padding: 2px 0; vertical-align: middle; } .submenu ul li span{ display:block; margin-top:5px; } .logo { margin: 0; }
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> <header> <div class="container"> <div class="col-sm-4"> <ul class="menu"> <li><a href="#">menu 1</a> <div class="submenu"> <ul class="prod-section"> <li><a href="#"><img src="http://via.placeholder.com/136x166"><span>shop all</span></a></li> <li><a href="#"><img src="http://via.placeholder.com/136x166"><span>photo</span></a></li> <li><a href="#"><img src="http://via.placeholder.com/136x166"><span>art</span></a></li> <li><a href="#"><img src="http://via.placeholder.com/136x166"><span>type</span></a></li> </ul> </div> </li> <li><a href="#">menu 2</a> <div class="submenu"> <ul class="prod-section"> <li><a href="#"><img src="http://via.placeholder.com/136x166"><span>shop all</span></a></li> <li><a href="#"><img src="http://via.placeholder.com/136x166"><span>shoes</span></a></li> <li><a href="#"><img src="http://via.placeholder.com/136x166"><span>clothes</span></a></li> </ul> </div> </li> <li><a href="#">menu 3</a> <div class="submenu"> <ul class="prod-section"> <li><a href="#"><img src="http://via.placeholder.com/136x166"><span>shop all</span></a></li> <li><a href="#"><img src="http://via.placeholder.com/136x166"><span>toys</span></a></li> <li><a href="#"><img src="http://via.placeholder.com/136x166"><span>art</span></a></li> <li><a href="#"><img src="http://via.placeholder.com/136x166"><span>type</span></a></li> </ul> </div> </li> </ul> </div> <div class="col-sm-4"> <h1 class="logo"> logo </h1> </div> </div> </header>
hope wanted, make submenu full width children inside centered, have removed paddings , margins , applied flex alignment
header { border-bottom: 1px solid #000; } .menu { margin:0; list-style: none; padding: 0; } .menu li { float: left; } .menu li .submenu{ display: none; } .menu li { color: #000; padding:10px; text-decoration: none; display: block; text-transform: uppercase; font-weight: bold; position: relative; } .menu li a:hover{ color:#999; } .menu > li > a::before { border-left: 13px solid transparent; border-right: 13px solid transparent; border-top: 13px solid #fff; bottom: -13px; content: ""; display: none; height: 0; left: 50%; position: absolute; transform: translatex(-50%); width: 0; z-index: 2; } .menu > li > a::after { border-left: 13px solid transparent; border-right: 13px solid transparent; border-top: 13px solid #000; bottom: -14px; content: ""; display: none; height: 0; left: 50%; position: absolute; transform: translatex(-50%); width: 0; z-index: 1; } .menu li:hover a::before, .menu li:hover a::after { display: block; } .menu li:hover .submenu { display: flex; } .submenu { background: #ebf2f2; left: 0; min-height: 300px; width: 100%; position: absolute; text-align: center; justify-content: center; align-items: center; top: 41px; transition: 0.3s linear 0s; } .submenu ul { margin: 0; padding: 0;} .submenu ul li { display: inline-block; float: none; line-height: 1; margin: 0; padding: 2px 0; vertical-align: middle; } .submenu ul li span{ display:block; margin-top:5px; }
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> <header> <div class="container"> <ul class="menu"> <li><a href="#">menu 1</a> <div class="submenu"> <ul class="prod-section"> <li><a href="#"><img src="http://via.placeholder.com/136x166"><span>shop all</span></a></li> <li><a href="#"><img src="http://via.placeholder.com/136x166"><span>photo</span></a></li> <li><a href="#"><img src="http://via.placeholder.com/136x166"><span>art</span></a></li> <li><a href="#"><img src="http://via.placeholder.com/136x166"><span>type</span></a></li> </ul> </div> </li> <li><a href="#">menu 2</a> <div class="submenu"> <ul class="prod-section"> <li><a href="#"><img src="http://via.placeholder.com/136x166"><span>shop all</span></a></li> <li><a href="#"><img src="http://via.placeholder.com/136x166"><span>shoes</span></a></li> <li><a href="#"><img src="http://via.placeholder.com/136x166"><span>clothes</span></a></li> </ul> </div> </li> <li><a href="#">menu 3</a> <div class="submenu"> <ul class="prod-section"> <li><a href="#"><img src="http://via.placeholder.com/136x166"><span>shop all</span></a></li> <li><a href="#"><img src="http://via.placeholder.com/136x166"><span>toys</span></a></li> <li><a href="#"><img src="http://via.placeholder.com/136x166"><span>art</span></a></li> <li><a href="#"><img src="http://via.placeholder.com/136x166"><span>type</span></a></li> </ul> </div> </li> </ul> </div> </header>
wiki
Comments
Post a Comment