I'm implementing a bootstrap menu based on css shapes and i'm having problems to display sub-menus i think it is because i have a fixed div in shape div.
.menu {
width: 100%;
height: 40px;
background-color: blue;
-webkit-clip-path: polygon(5% 0, 100% 0, 100% 100%, 0 100%, 0 100%);
clip-path: polygon(5% 0, 100% 0, 100% 100%, 0 100%, 0 100%);
position: relative;
}
.menu ul li {
font-family: 'Seravek';
font-size: 14px;
text-transform: uppercase;
}
.menu:before {
content: '';
width: 99.5%;
height: 38px;
-webkit-clip-path: polygon(5% 0, 100% 0, 100% 100%, 0 100%, 0 100%);
clip-path: polygon(5% 0, 100% 0, 100% 100%, 0 100%, 0 100%);
background: grey;
display: block;
position: absolute;
top: 2px;
left: 2px;
right: 2px;
}
.navbar-default .navbar-collapse, .navbar-default .navbar-form {
height: 40px !important;
}
.navbar-default .navbar-collapse #menu-menuprincipal, .navbar-default .navbar-form #menu-menuprincipal {
height: 40px;
}
.navbar-default .navbar-collapse #menu-menuprincipal li, .navbar-default .navbar-form #menu-menuprincipal li {
height: 40px;
}
.navbar-default .navbar-collapse #menu-menuprincipal li a, .navbar-default .navbar-form #menu-menuprincipal li a {
padding-top: 0;
padding-bottom: 0;
line-height: 40px;
color: black;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<nav class="navbar navbar-default">
<div class="container-fluid no-padding">
<div class="row no-margin">
<div class="col-xs-4 col-sm-4 col-md-3 logo">
<div class="navbar-header">
<a class="navbar-brand" href="/site/">
<img alt="site" src="<?php bloginfo('template_url')?>/images/logo.png">
</a>
</div>
</div>
<div class="col-xs-4 col-sm-4 col-md-9 no-padding">
<div class="menu-operations">
<div class="languages">
</div>
<div class="social">
</div>
</div>
</div>
<div class="col-xs-4 col-sm-4 col-md-9 no-padding">
<div class="navbar-header logo-vertical">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="true">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-9 no-padding">
<div class="menu">
<div id="bs-example-navbar-collapse-1" class="collapse navbar-collapse">
<ul id="menu-menuprincipal" class="nav navbar-nav navbar-right">
<li id="menu-item-39" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-39"><a title="Empresa" href="">Empresa</a></li>
<li id="menu-item-37" class="menu-item menu-item-type-post_type menu-item-object-page current-page-ancestor current-menu-ancestor current-menu-parent current-page-parent current_page_parent current_page_ancestor menu-item-has-children menu-item-37 dropdown"><a title="Produção" href="#" data-toggle="dropdown" class="dropdown-toggle" aria-haspopup="true">Produção <span class="caret"></span></a>
<ul role="menu" class=" dropdown-menu">
<li id="menu-item-38" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-18 current_page_item menu-item-38 active"><a title="Produção" href="">Produção</a></li>
<li id="menu-item-36" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-36"><a title="Equipamentos" href="">Equipamentos</a></li>
</ul>
</li>
<li id="menu-item-33" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-33"><a title="Mercados" href="">Mercados</a></li>
<li id="menu-item-30" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-30 dropdown"><a title="Qualidade e Ambiente" href="#" data-toggle="dropdown" class="dropdown-toggle" aria-haspopup="true">Qualidade e Ambiente <span class="caret"></span></a>
<ul role="menu" class=" dropdown-menu">
<li id="menu-item-32" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-32"><a title="Qualidade" href="">Qualidade</a></li>
<li id="menu-item-31" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-31"><a title="Ambiente" href="">Ambiente</a></li>
</ul>
</li>
<li id="menu-item-29" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-29"><a title="Notícias" href="">Notícias</a></li>
<li id="menu-item-28" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-28"><a title="Contactos" href="">Contactos</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</nav>
I'm using wordpress with wp_bootstrap_navwalker
and the code is link thi inside menu class:
<div class="menu">
<?php
wp_nav_menu( array(
'menu' => 'menuPrincipal',
'theme_location' => 'primary',
'depth' => 2,
'container' => 'div',
'container_class' => 'collapse navbar-collapse',
'container_id' => 'bs-example-navbar-collapse-1',
'menu_class' => 'nav navbar-nav navbar-right',
'fallback_cb' => 'wp_bootstrap_navwalker::fallback',
'walker' => new wp_bootstrap_navwalker())
);
?>
</div>
Try this out:
I just adapt my setup by your data. Generaly, you need to define
items_wrap
to get results you need.And also change
container_id
(wp_bootstrap_navwalker
) to something more natural.Also from SEO side if you follow HTML5 rules, use
<nav>
tag. That also follow Bootstrap rules