Vertically align burger menu in mobile mode - html

I would like to vertically align the "hamburger" menu in mobile mode, in top AND sticky mode.
I tried this way, it works in sticky mode, but not in top mode:
.banner.navbar.navbar-default.navbar-static-top button
{
margin-top: 20px !important;
}
My website is the following: link
Source code:
<header class="banner navbar navbar-default navbar-static-top " role="banner" data-transparent-header="false">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div id="logo">
<a href="https://www.atvmototraveler.ro/">
<img data-rjs="2" class="logo-trans logo-reg" src="https://www.atvmototraveler.ro/wp-content/uploads/2022/10/atv_de_inchiriat_inchirieri_atv_inchirieri_motociclete_cluj_cluj_napoca_atvmototraveler-61x61#2x.png" alt="Atvmototraveler" data-rjs-processed="true" width="61" height="61">
<img data-rjs="2" class="logo-main logo-reg" src="https://www.atvmototraveler.ro/wp-content/uploads/2022/10/inchirieri_atv-inchiriat_inchirieri_atv_cluj_inchiriere_atv_de_inchiriat_rent_atv_cluj_logo-1-301x300#2x.png" alt="Atvmototraveler" data-rjs-processed="true" width="80" height="80">
</a>
</div>
</div>
<div class="themo_cart_icon"><i class="th-icon th-i-cart3"></i></div>
<nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation" style="height: 0px;">
<ul id="menu-atv-de-inchiriat-meniu" class="nav navbar-nav"><li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-home current-menu-item page_item page-item-312 current_page_item menu-item-447"><i class="fa fa-home"></i> Închirieri ATV</li>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1245"><i class="fas fa-map-signs"></i> Trasee</li>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1207"><i class="fas fa-truck-monster"></i> Flota</li>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1645"><i class="far fa-building"></i> Despre Noi</li>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-724"><i class="fas fa-envelope"></i> Contact</li>
<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-557"><i class="fas fa-key"></i> Rezervă Acum</li>
</ul> </nav>
</div>
</header>

Try adding display flex.
header .container>.navbar-header::after, .container>.navbar-header::before {
content: none;
}
header .container>.navbar-header {
display: flex;
justify-content: space-between;
align-items: center;
flex-direction: row-reverse;
width: 100%;
}

Related

Nav issues - fixed-top breaks navbar-right and covers logo

I am using a bootstrap Nav for this page
http://careers.baffinland.com
I added the fixed-top class as I need a sticky top, but that then overrides navbar-right class and aligns the menu to the left. It also covers up my logo which was aligned left.
In addition i would like to hamburger responsive menu to open to the left, when you open in responsive mode, the drop down is stuck to the right of the button (this wont be clear until menu is aligned right again) which forces the toggle to jump to the middle of the page
<!-- <div class="site-nav col-6 col-sm-6 col-md-9">-->
<nav class="navbar navbar-expand-lg navbar-light bg-nav-bar fixed-top " role="navigation" style="max-width: 1360px; margin: 0 auto;">
<!-- Brand and toggle get grouped for better mobile display -->
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-controls="bs-example-navbar-collapse-1" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#"><img src="http://careers.baffinland.com/wp-content/themes/darkStarMediaTheme/images/logo.png" width="236" alt="Baffinland logo" class="banner-logo " style="float: left; text-align:left; left: 0px;" /></a>
<div id="bs-example-navbar-collapse-1" class="collapse navbar-collapse"><ul id="menu-main-menu" class="nav navbar-nav navbar-right"><li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-16" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children dropdown menu-item-16 nav-item"><a title="About Us" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="dropdown-toggle nav-link" id="menu-item-dropdown-16">About Us</a>
<ul class="dropdown-menu" aria-labelledby="menu-item-dropdown-16" role="menu">
<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-17" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-17 nav-item"><a title="Who We Are" href="https://www.baffinland.com/about-us/who-we-are/" class="dropdown-item">Who We Are</a></li>
</ul>
</li>
<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-20" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children dropdown menu-item-20 nav-item"><a title="Operation" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="dropdown-toggle nav-link" id="menu-item-dropdown-20">Operation</a></li>
</ul></div>
</nav>
<!-- </div> -->
Your logo is outside of your navbar and your "navbar-brand" is on "display-none".
<nav class="navbar navbar-expand-lg navbar-light bg-nav-bar fixed-top" role="navigation" style="max-width: 1360px; margin: 0 auto;">
<!-- Brand and toggle get grouped for better mobile display -->
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-controls="bs-example-navbar-collapse-1" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<img src="http://careers.baffinland.com/wp-content/themes/darkStarMediaTheme/images/logo.png" width="236" alt="Baffinland logo" class="banner-logo " style="float: left; text-align:left; left: 0px;">
<div id="bs-example-navbar-collapse-1" class="collapse navbar-collapse">
<ul id="menu-main-menu" class="nav navbar-nav navbar-right">
<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-16" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children dropdown menu-item-16 nav-item">
<a title="About Us" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="dropdown-toggle nav-link" id="menu-item-dropdown-16">About Us</a>
<ul class="dropdown-menu" aria-labelledby="menu-item-dropdown-16" role="menu" style="display: none;">
<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-17" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-17 nav-item">
<a title="Who We Are" href="https://www.baffinland.com/about-us/who-we-are/" class="dropdown-item">Who We Are</a>
</li>
<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-18" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-18 nav-item">
<a title="Our Leadership" href="https://www.baffinland.com/about-us/our-leadership/" class="dropdown-item">Our Leadership</a>
</li>
<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-19" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-19 nav-item">
<a title="FAQ" href="http://www.baffinland.com/about-us/faq/" class="dropdown-item">FAQ</a></li>
</ul>
</li>
<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-20" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children dropdown menu-item-20 nav-item">
<a title="Operation" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="dropdown-toggle nav-link" id="menu-item-dropdown-20">Operation</a>
<ul class="dropdown-menu" aria-labelledby="menu-item-dropdown-20" role="menu" style="display: none;">
<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-21" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-21 nav-item">
<a title="Mary River Mine" href="http://www.baffinland.com/operation/mary-river-mine/" class="dropdown-item">Mary River Mine</a>
</li>
<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-22" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-22 nav-item">
<a title="Shipping & Monitoring" href="http://www.baffinland.com/operation/shipping-and-monitoring/" class="dropdown-item">Shipping & Monitoring</a>
</li>
</ul>
</li>
<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-23" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children dropdown menu-item-23 nav-item">
<a title="Sustainability" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="dropdown-toggle nav-link" id="menu-item-dropdown-23">Sustainability</a>
<ul class="dropdown-menu" aria-labelledby="menu-item-dropdown-23" role="menu">
<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-24" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-24 nav-item">
<a title="Overview" href="http://www.baffinland.com/sustainability/overview/" class="dropdown-item">Overview</a>
</li>
<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-25" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-25 nav-item">
<a title="Health & Safety" href="http://www.baffinland.com/sustainability/health-and-safety/" class="dropdown-item">Health & Safety</a>
</li>
<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-26" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-26 nav-item">
<a title="Environment" href="http://www.baffinland.com/sustainability/environment/" class="dropdown-item">Environment</a>
</li>
<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-27" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-27 nav-item">
<a title="Communities" href="http://www.baffinland.com/sustainability/communities/" class="dropdown-item">Communities</a>
</li>
<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-28" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-28 nav-item">
<a title="Learning & Development" href="http://www.baffinland.com/sustainability/learning-and-development/" class="dropdown-item">Learning & Development</a>
</li>
</ul>
</li>
<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-29" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-home current-menu-item page_item page-item-11 current_page_item active menu-item-29 nav-item">
<a title="Careers" href="http://careers.baffinland.com/" class="nav-link">Careers</a></li>
<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-30" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children dropdown menu-item-30 nav-item">
<a title="Media Centre" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="dropdown-toggle nav-link" id="menu-item-dropdown-30">Media Centre</a>
<ul class="dropdown-menu" aria-labelledby="menu-item-dropdown-30" role="menu" style="display: none;">
<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-31" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-31 nav-item">
<a title="News Releases" href="http://www.baffinland.com/media-centre/news-releases/" class="dropdown-item">News Releases</a>
</li>
<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-32" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-32 nav-item">
<a title="Media Gallery" href="http://www.baffinland.com/media-centre/media-gallery/" class="dropdown-item">Media Gallery</a>
</li>
<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-33" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-33 nav-item">
<a title="Document Portal" href="http://www.baffinland.com/media-centre/document-portal/" class="dropdown-item">Document Portal</a>
</li>
</ul>
</li>
<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-34" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children dropdown menu-item-34 nav-item">
<a title="Contact Us" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="dropdown-toggle nav-link" id="menu-item-dropdown-34">Contact Us</a>
<ul class="dropdown-menu" aria-labelledby="menu-item-dropdown-34" role="menu" style="display: none;">
<li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-35" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-35 nav-item">
<a title="Contact Information" href="http://www.baffinland.com/contact-us/contact-information/" class="dropdown-item">Contact Information</a>
</li>
</ul>
</li>
</ul>
</div>
</nav>
I put your logo into the "nav" tag, maybe this helps you more to figure out. I recommend to copy one of these templates, so your html structure will work. https://getbootstrap.com/docs/4.4/components/navbar/
Well, navbar-right worked before I added the fixed-top class, you can disable fixed-top and try for yourself...
regardless, I did try your solution and it didn't work. I do appreciate the help though..
What I did do was this, I just added right margins to navbar-brand and pushed it over to where I wanted it

Icons above bootstrap navbar

I want to put some icons (facebook, instagram, youtube, whatsapp) above of navbar elements, like this:
This is my code:
<nav class="navbar fixed-top navbar-expand-lg navbar-light navbar-custom">
<a class="navbar-brand" href="http://localhost/wp/">
<img src="http://localhost/wp/wp-content/uploads/2019/05/cropped-logo-1.png"> </a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto"></ul>
<ul id="menu-menu-principal" class="navbar-nav">
<li id="menu-item-10" class="nav-item active"><a title="INICIO" class=" nav-link" href="#">INICIO</a></li>
<li id="menu-item-12" class="nav-item"><a title="NOSOTROS" class=" nav-link" href="#">NOSOTROS</a></li>
<li id="menu-item-19" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-19 nav-item"><a title="BLOG" class=" nav-link" href="#">BLOG</a></li>
<li id="menu-item-20" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20 nav-item"><a title="CONTACTO" class=" nav-link" href="#">CONTACTO</a></li>
</ul>
</div>
</nav>
Anybody can help me?
Here's how you do it, Since you want to make your icon-bar above navbar as fixed, we will have to remove the fixed-top class from the navbar, because then giving position:fixed to icon-bar would overlap with our navbar.
So wrap both navbar and icon-bar inside a wrapper div and make that div as position: fixed instead. Rest of the things are self-explanatory if you know basic css.
Here is a code snippet or a fiddle in case you can't figure it out,
#top-wrapper {
position: fixed;
top: 0; left: 0; right: 0;
background-color: green;
z-index: 999;
}
#top-wrapper .icon-bar {
width: 100%;
overflow: auto;
}
#top-wrapper .icon-bar ul {
float: right;
list-style: none;
margin: 0;
padding: 16px 16px 16px 0;
}
#top-wrapper .icon-bar ul li {
float: left;
padding: 0 16px;
border-right: 1px dotted #fff;
}
#top-wrapper .icon-bar ul li:last-child {
border: none;
}
#top-wrapper ul li i {
color: #FFF;
font-size: 14px;
}
.section {
height: 100vh;
background-color: grey;
}
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<!-- Popper JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<!-- font awesome cdn -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div id="top-wrapper"> <!-- this is our wrapper div -->
<div class="icon-bar">
<ul>
<li><i class="fa fa-facebook"></i></li>
<li><i class="fa fa-instagram"></i></li>
<li><i class="fa fa-youtube-play"></i></li>
<li><i class="fa fa-whatsapp"></i></li>
</ul>
</div>
<nav class="navbar navbar-expand-lg navbar-light navbar-custom">
<a class="navbar-brand" href="http://localhost/wp/">
<img src="http://localhost/wp/wp-content/uploads/2019/05/cropped-logo-1.png"> </a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto"></ul>
<ul id="menu-menu-principal" class="navbar-nav">
<li id="menu-item-10" class="nav-item active"><a title="INICIO" class=" nav-link" href="#">INICIO</a>
</li>
<li id="menu-item-12" class="nav-item"><a title="NOSOTROS" class=" nav-link" href="#">NOSOTROS</a>
</li>
<li id="menu-item-19" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-19 nav-item"><a title="BLOG" class=" nav-link" href="#">BLOG</a></li>
<li id="menu-item-20" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20 nav-item"><a title="CONTACTO" class=" nav-link" href="#">CONTACTO</a></li>
</ul>
</div>
</nav>
</div>
<div class="section">Hello world</div>
<div class="section">Hello world</div>
<div class="section">Hello world</div>
At first you need to load Font Awesome then use it.
Look at this links to understand how it works. It is simple.
Introduction Font Awesome
Brand icons
Instagram Example
Try this code.
Be sure that you loaded Font Awesome correctly.
<nav class="navbar fixed-top navbar-expand-lg navbar-light navbar-custom">
<div class="social">
<i class='fab fa-instagram' style='font-size:24px'></i>
<i class='fab fa-facebook' style='font-size:24px'></i>
<i class='fab fa-twitter' style='font-size:24px'></i>
<i class='fab fa-linkedin' style='font-size:24px'></i>
<i class='fab fa-pinterest' style='font-size:24px'></i>
</div>
<div class="menu">
<a class="navbar-brand" href="http://localhost/wp/">
<img src="http://localhost/wp/wp-content/uploads/2019/05/cropped-logo-1.png"> </a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto"></ul>
<ul id="menu-menu-principal" class="navbar-nav">
<li id="menu-item-10" class="nav-item active"><a title="INICIO" class=" nav-link" href="#">INICIO</a></li>
<li id="menu-item-12" class="nav-item"><a title="NOSOTROS" class=" nav-link" href="#">NOSOTROS</a></li>
<li id="menu-item-19" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-19 nav-item"><a title="BLOG" class=" nav-link" href="#">BLOG</a></li>
<li id="menu-item-20" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20 nav-item"><a title="CONTACTO" class=" nav-link" href="#">CONTACTO</a></li>
</ul>
</div>
</div>
</nav>
Here's your answer. I can tell you're using WordPress from your code.
1) Install the Better Font Awesome plugin and activate it - https://wordpress.org/plugins/better-font-awesome/
2) Add the following code:
Note: aria-labels in the code below is used by screen readers like VoiceOver on a Mac (see https://www.youtube.com/watch?v=5R-6WvAihms for a demo) so it's good to include this code. A screen reader (software on a computer, cell phone, or tablet) will say something like "Facebook link" and "WhatsApp link" and then people with disabilties (i.e. blind people) can know it's a link to click on.
<a href="https://www.facebook.com/" target="_blank" aria-label="Facebook">
<i class="fab fa-facebook-square"></i>
</a>
<a href="https://www.whatsapp.com/" target="_blank" aria-label="WhatsApp">
<i class="fab fa-whatsapp"></i>
</a>
etc.
3) Do searches for more Font Awesome icon code at https://fontawesome.com/icons?d=gallery

Bootstrap - Dropdown and mobile menu doesn't work

I'm developing a wordpress website and I'm using bootstrap.
My menu have to allow dropdown menu but when I click it don't open nothing but if I inspect the code the <li> are there.
In mobile the toggle shows but I can't open when click. I see dom change when o click but nothing show.
My html is this and the menu shows perfectly in large screens.
<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>
First of all you need to import jquery in your page. Then try again and show what happens
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

to give transition effect to dropdown while in mobile view

I want to try dropdown transition effect in my website. I have tried giving
transition: all 2s ease-in-out
but it does not give result. I want to show dropdown while in hover in mobile view with some transition effect. I am currently using some of the class of bootstrap.
Here's my HTML
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header pull-left">
<!-- <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button> -->
<a class="navbar-brand" href="#" rel="home" title="Swiss-Japanese Society – www.swiss-japan.ch">
<img src="bild/Schweizerisch-Japanische-Gesellschaft.png" class="img-responsive showabove"></a>
<a class="navbar-brand" href="#" rel="home" title="Swiss-Japanese Society – www.swiss-japan.ch">
<img src="bild/logomiddle.png" class="img-responsive showinbetween"></a>
<a class="navbar-brand" href="#" rel="home" title="Swiss-Japanese Society – www.swiss-japan.ch">
<img src="bild/logosmall.png" class="showless"></a>
</div>
<div class="navbar-header pull-right">
<ul class="nav pull-left">
<!-- <li class="navbar-text pull-left">User Name</li> -->
<li class="dropdown pull-right">
<div id="lang_sel"><ul><li>DE <ul><li class="icl-en">EN</li></ul></li></ul><span class="sj-down-arrow">▾</span></div> </li>
</ul>
<!-- Required bootstrap placeholder for the collapsed menu -->
<button type="button" data-toggle="collapse" data-target=".navbar-collapse" class="navbar-toggle"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="navbar-collapse navbar-right collapse" id="bs-example-navbar-collapse-1" aria-expanded="false" style="height: 21px;">
<ul id="menu-menu-1" class="nav navbar-nav"><li id="menu-item-20" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-12 current_page_item menu-item-20">Startseite</li>
<li id="menu-item-580" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-580">Uber Uns
<ul class="sub-menu">
<li id="menu-item-175" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-175">Ziel und Zweck
<ul class="sub-menu">
<li id="menu-item-226" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-226">testing</li>
</ul>
</li>
<li id="menu-item-183" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-183">Leitbild</li>
<li id="menu-item-204" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-204">Entstehungsgeschichte</li>
<li id="menu-item-219" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-219">Vorstand</li>
<li id="menu-item-218" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-218">Aktueller Jahresbericht</li>
<li id="menu-item-217" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-217">Archiv Jahresberichte</li>
</ul>
</li>
<li id="menu-item-581" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-581">Veranstaltungen
<ul class="sub-menu">
<li id="menu-item-248" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-248">Jubiläum 2014</li>
<li id="menu-item-245" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-245">Aktuelle Veranstaltungen</li>
<li id="menu-item-247" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-247">Vergangene Veranstaltungen</li>
<li id="menu-item-246" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-246">Fotogalerie</li>
</ul>
</li>
<li id="menu-item-582" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-582">Mitgliedschaft
<ul class="sub-menu">
<li id="menu-item-232" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-232">Aufnahme-Bedingungen</li>
<li id="menu-item-233" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-233">Beitrittsgesuch</li>
</ul>
</li>
<li id="menu-item-50" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-50">Varia</li>
<li id="menu-item-40" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-40">Links</li>
<li id="menu-item-30" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-30">Kontakt</li>
</ul>
</div>
</div>
</div>
sorry for my language. Can someone tell me in which class should i need to give transition so that to make the dropdown while in hover or while in clicked action.
below is css for dropdown class called sub-menu:
#media (max-width: 900px)
.navbar-nav ul {
position: static;
visibility: visible;
opacity: 1;
margin: 0;
background: none;
box-shadow: none;
display: none;
}
#media (max-width: 900px)
.navbar-nav {
margin: 0;
padding: 0;
position: fixed;
left: 0; width: 100%;
z-index: 10;
background: #f8f6f6;
overflow: visible;
}
#media (max-width: 900px)
.navbar-nav li {
background: #fff;
position: static;
display: block;
float: none;
border: 0;
margin: 0;
border-bottom: 1px solid #fff;
border-top: 1px solid #999;
}
This is because bootstrap gives you dropdown which is display:none by default and on hover it is display:block but according to css rule transition property doesn't works on show hide condition.
You have to create your own dropdown with some other effect or you can use a plugin.

How can I align this menu to be center?

I have this site:
link
CODE HTML:
<div class="content-menu">
<div class="navbar navbar-inverse bs-docs-nav" role="banner">
<div class="navbar-header">
<button class="navbar-toggle" data-target=".bs-navbar-collapse" data-toggle="collapse" type="button"><span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span></button>
<div class="logo-mobile">
<img src="http://dg-design.ch/bagel/wp-content/themes/wp_bagel/assets/img/logo-mobile.png">
<ul class="lang-top navbar-right">
<li>
En
</li>
<li>
fr
</li>
</ul>
</div>
</div>
<nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation">
<div class="menu-menu-1-container">
<ul class="nav navbar-nav" id="menu-menu-1">
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22" id="menu-item-22">
Home
</li>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-27" id="menu-item-27">
News
</li>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-65" id="menu-item-65">
Events
</li>
<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-71" id="menu-item-71">
Delivery
</li>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-23" id="menu-item-23">
About us
</li>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-25" id="menu-item-25">
Contact
</li>
</ul>
</div>
<ul class="lang-top navbar-right">
<li><img src="http://dg-design.ch/bagel/wp-content/themes/wp_bagel/assets/img/logo-menu.png"></li>
<li class="icon"><img src="http://dg-design.ch/bagel/wp-content/themes/wp_bagel/assets/img/menu.png"></li>
<li class="icon">
MENU
</li>
<li class="icon">
En
</li>
<li class="icon">
fr
</li>
<li class="icon"><img src="http://dg-design.ch/bagel/wp-content/themes/wp_bagel/assets/img/menu.png"></li>
<li class="icon"><img src="http://dg-design.ch/bagel/wp-content/themes/wp_bagel/assets/img/menu.png"></li>
<li class="icon"><img src="http://dg-design.ch/bagel/wp-content/themes/wp_bagel/assets/img/menu.png"></li>
</ul>
</nav>
</div>
</div>
CODE CSS:
.wrapper .content .content-menu {
/* width: 91%; */
/*background: #5B626A;*/
position: absolute;
z-index:9999;
/* left: 4%; */
margin: 0 auto;
left: 0;
top: 0;
right: 0;
}
I tried to put the above code "text align: center" but unfortunately does not work. Can you tell me please why it does not work?
What must I change for the items to be aligned in the center on any resolution?
Try this:
HTML
<nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation">
<div class="menu-menu-1-container">
<ul class="nav navbar-nav" id="menu-menu-1"></ul>
<ul class="lang-top navbar-right"></ul>
</div>
</nav>
CSS
collapse navbar-collapse bs-navbar-collapse{
margin: 0px auto;
width: 1500px;
}
Create one More Div under navbar tag fixed width & set the nav css according width class ex : -
<div class="content-menu">
<div class="navbar navbar-inverse bs-docs-nav" role="banner">
<div class="width">
<div class="navbar-header">
<button class="navbar-toggle" data-target=".bs-navbar-collapse" data-toggle="collapse" type="button"><span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span></button>
<div class="logo-mobile">
<img src="http://dg-design.ch/bagel/wp-content/themes/wp_bagel/assets/img/logo-mobile.png">
<ul class="lang-top navbar-right">
<li>
En
</li>
<li>
fr
</li>
</ul>
</div>
</div>
<nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation">
<div class="menu-menu-1-container">
<ul class="nav navbar-nav" id="menu-menu-1">
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22" id="menu-item-22">
Home
</li>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-27" id="menu-item-27">
News
</li>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-65" id="menu-item-65">
Events
</li>
<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-71" id="menu-item-71">
Delivery
</li>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-23" id="menu-item-23">
About us
</li>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-25" id="menu-item-25">
Contact
</li>
</ul>
</div>
<ul class="lang-top navbar-right">
<li><img src="http://dg-design.ch/bagel/wp-content/themes/wp_bagel/assets/img/logo-menu.png"></li>
<li class="icon"><img src="http://dg-design.ch/bagel/wp-content/themes/wp_bagel/assets/img/menu.png"></li>
<li class="icon">
MENU
</li>
<li class="icon">
En
</li>
<li class="icon">
fr
</li>
<li class="icon"><img src="http://dg-design.ch/bagel/wp-content/themes/wp_bagel/assets/img/menu.png"></li>
<li class="icon"><img src="http://dg-design.ch/bagel/wp-content/themes/wp_bagel/assets/img/menu.png"></li>
<li class="icon"><img src="http://dg-design.ch/bagel/wp-content/themes/wp_bagel/assets/img/menu.png"></li>
</ul>
</nav>
</div>
</div>
Css
.width{ width:1100px; margin:auto; }
width set on your screen size max screen size is 1100px / 1050px laptop - computer
Here is my solution:
put the ul into the div
<div class="menu-menu-1-container">
<ul class="nav navbar-nav" id="menu-menu-1">
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22" id="menu-item-22">
Home
</li>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-27" id="menu-item-27">
News
</li>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-65" id="menu-item-65">
Events
</li>
<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-71" id="menu-item-71">
Delivery
</li>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-23" id="menu-item-23">
About us
</li>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-25" id="menu-item-25">
Contact
</li>
</ul>
<ul class="lang-top navbar-right">
<li><img src="http://dg-design.ch/bagel/wp-content/themes/wp_bagel/assets/img/logo-menu.png"></li>
<li class="icon"><img src="http://dg-design.ch/bagel/wp-content/themes/wp_bagel/assets/img/menu.png"></li>
<li class="icon">
MENU
</li>
<li class="icon">
En
</li>
<li class="icon">
fr
</li>
<li class="icon"><img src="http://dg-design.ch/bagel/wp-content/themes/wp_bagel/assets/img/menu.png"></li>
<li class="icon"><img src="http://dg-design.ch/bagel/wp-content/themes/wp_bagel/assets/img/menu.png"></li>
<li class="icon"><img src="http://dg-design.ch/bagel/wp-content/themes/wp_bagel/assets/img/menu.png"></li>
</ul>
</div>
in css:
#menu-menu-1, .lang-top{
display: inline-block;
}
remote float: left from both the ul
.navbar-inverse .navbar-nav {
padding-left: 17px;
padding-top: 75px;
padding-bottom: 75px;
}
#menu-menu-1-container{
text-align: center;
position: relative;
}
This the result:
Step 1) Open a div tag between wrapper and container.
Step 2) Add css code to style tag.
HTML:
<div class="warpper" >
<div class="middle">
<div class="container ">
YOUR MENU BLOCK
</div>
</div>
</div>
CSS:
.middle {
width: 75%;
position: absolute;
margin-left: -37%;
left: 50%;
}