navbar brand not styling and navbar has no background color just transparent - background

My navbar won't play ball. It's almost there but I have two problems which I can't seem to resolve.
1) When you scroll the page the navbar is transparent. I added some padding to the top for spacing but I can't see why it's transparent. There are no opacity settings in my CSS!
2) I've got my logo aligned to the right with navbar-brand but no matter what I do with the CSS I can't seem to change the text color, size or type.
3) I'm also struggling to make the background image fill the whole page. I've tried all sorts to make it fit but it won't.
Can anyone help with my problems? I've temporarily hosted the index page as I have a feeling something in the rest of my css is messing up my navbar!
Here is the link...
http://www.wisbechinlinespeed.co.uk/index-new.htm
I've googled the problems and tried most suggestions, but nothing seems to be working.
.menu-area{background: #F9F3DB; }
.dropdown-menu{padding:0;margin:0;border:0 solid transition!important;border:0 solid rgba(0,0,0,.15);border-radius:0;-webkit-box-shadow:none!important;box-shadow:none!important}
.mainmenu a, .navbar-default
.navbar-nav > li > a,
.mainmenu ul li a ,
.navbar-expand-lg .navbar-nav .nav-link{color:#6D6C6B;font-size:16px;text-transform:capitalize;padding:10px 10px;font-family:'calibri',sans-serif;display: block !important;}
/*==========WISS logo==========*/
.navbar-default
.navbar-brand .navbar-text {
color:#6D6C6B;}
/*==========active page properties==========*/
.mainmenu
.active a,
.mainmenu
.active a:focus,
.mainmenu
.active a:hover,
.mainmenu li a:hover,
.mainmenu li a:focus ,
.navbar-default
.navbar-nav>.show>a,
.navbar-default
.navbar-nav>.show>a:focus,
.navbar-default
.navbar-nav>.show>a:hover{background: #6D6C6B; color: #F9F3DB; outline: 0;}
/*==========Sub Menu=v==========*/
.mainmenu
.collapse ul > li:hover > a{background: #6D6C6B;color: #F9F3DB; }
.mainmenu
.collapse ul ul > li:hover > a,
.navbar-default
.navbar-nav
.show
.dropdown-menu > li > a:focus,
.navbar-default
.navbar-nav
.show
.dropdown-menu > li > a:hover{background: #6D6C6B;}
.mainmenu
.collapse ul ul ul > li:hover > a{background: #6D6C6B;}
.mainmenu .collapse ul ul,
.mainmenu .collapse ul ul
.dropdown-menu{background:#d9d9d8;}
.mainmenu
.collapse ul ul ul,
.mainmenu .collapse ul ul ul
.dropdown-menu{background:#d9d9d8}
.mainmenu .collapse ul ul ul ul,
.mainmenu .collapse ul ul ul ul
.dropdown-menu{background:#d9d9d8}
/******************************Drop-down menu work on hover**********************************/
.mainmenu{background: none;border: 0 solid;margin: 0;padding: 0;min-height:20px;width: 100%;}
#media only screen and (min-width: 767px) {
.mainmenu
.collapse ul li:hover> ul{display:block}
.mainmenu
.collapse ul ul{position:absolute;top:100%;left:0;min-width:250px;display:none}
/*******/
.mainmenu
.collapse ul ul li{position:relative}
.mainmenu .collapse ul ul li:hover> ul{display:block}
.mainmenu .collapse ul ul ul{position:absolute;top:0;left:100%;min-width:250px;display:none}
/*******/
.mainmenu .collapse ul ul ul li{position:relative}
.mainmenu .collapse ul ul ul li:hover ul{display:block}
.mainmenu .collapse ul ul ul ul{position:absolute;top:0;left:-100%;min-width:250px;display:none;z-index:1}
}
#media only screen and (max-width: 767px) {
.navbar-nav .show .dropdown-menu
.dropdown-menu > li > a{padding:16px 15px 16px 35px}
.navbar-nav .show .dropdown-menu
.dropdown-menu
.dropdown-menu > li > a{padding:16px 15px 16px 45px}
}
<!------ nav bar ---------->
<div id="menu_area" class="menu-area">
<div class="container">
<div class="row">
<nav class="navbar navbar-dark navbar-expand-lg fixed-top mainmenu">
<a class="navbar-brand order-md-last" href="#">WISBECH INLINE SPEED</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">
<li class="active">Home <span class="sr-only">(current)</span></li>
<li>News</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Club Information</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li>About Us</li>
<li>Join Our Club</li>
<li>Club Statistics</li>
<li>Calendar</li>
<li>Results</li>
<li>Track Info</li>
<li>Official Documents</li>
<li>Sponsorship</li>
<li>Contact Us</li>
<li>Links</li>
</ul>
<li class="dropdown">
<a class="dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Meet The Team</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li>The Team</li>
<li>The Coaches</li>
<li>The Committee</li>
</ul>
<li class="dropdown">
<a class="dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Training Tips</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li>Nutrition</li>
<li>Technique</li>
<li>Preventing Injuries</li>
<li>Maintenance</li>
<li>Equipment</li>
</ul>
<li class="dropdown">
<a class="dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Galleries</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li class="dropdown">
<a class="dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Photos</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li>2018</li>
<li>2017</li>
<li>2016</li>
<li>2015</li>
</ul>
<li>Team Photos</li>
<li>Videos</li>
<li class="dropdown">
<a class="dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Media</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li>Press Reports</li>
<li>Archives</li>
</ul>
<li class="dropdown">
<a class="dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Archives</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li>1980's and 90's</li>
<li>2000's</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</nav>
</div>
</div>
</div>
<!------ end new nav bar ---------->
1) Transparent navbar but I want it to be #F9F3DB
2) navbar brand CSS doesn't change the text type, I want to change the color, font type and size
3) Background image of the entire page doesn't fill the page. I would like it to fit right to the bottom.

1) For the first problem the solution is to remove the div container, row container and menu-area. I don't know if they are needed but in many bootstrap examples there is just nav tag. example:
<!--Navigation Bar-->
<nav>
<div>
<img>
<div>
<a><!--Here put the logo image or text--></a>
</div>
<ul>
<li><a>First</a></li>
<li><a>Second</a></li>
<li><a>.....</a></li>
</ul>
</div>
</nav>
Examples are here Bootstrap Navbar Examples
Done this, just set the background in the .mainmenu class:
.mainmenu {
background: none;
border: 0 solid;
margin: 0;
padding: 0;
min-height: 20px;
width: 100%;
background: #f9f3db; /*---background set---*/
}
2) For this the solution is easy because you use navbar-dark class that has color: white that takes over from your css rules. So you can do two things.Or remove that class if it is useless for you, or use !important after css rules. example:
.mainmenu a{
color: #fff !important;
}
3) Should be this the solution:
background-position: right bottom;

Related

How do I extend my navbar banner below my navbar row?

I'm rebuilding a new website and upgrading from Bootstrap 3.3 to Bootstrap 5. I'm re-creating the look and feel of the navbar seen here. I've gotten very close but am having trouble with the banner. I can't figure out how to get the banner to extend below the navbar and still fit within the container class.
Here's a chunk of their code that displays the image I'm also opting to use:
<nav class="navbar navbar-inverse navbar-static-top">
<script src="http://www.utah.gov/nav/fluidheader.js" type="text/javascript" class="utahgov"></script>
<div class="container">
<img src="root/images/purpleLogo.png" class="purpleLogo" />
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav ">
<li class="dropdown">
HOME<span class="caret"></span>
<ul class="dropdown-menu scrollable-menu" role="menu">
<li >Division Home</li>
<li>Oil and Gas Program Home</li>
</ul>
</li>
<li>FORMS</li>
<li>STATISTICS</li>
<li>WELL FILES</li>
<li class="dropdown">
QUICK REFERENCES<span class="caret"></span>
<ul class="dropdown-menu scrollable-menu" role="menu">
<li>Well Bonding</li>
<li>Drilling Permits</li>
<li>Drilling a Well</li>
<li>Operator Changes</li>
<li>Reporting</li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
It looks like all they're doing is putting the image in the same container as the navbar items and the banner is automatically spilling out of the navbar. So far, I have the navbar elements in their own row. Then I divided the banner from the navbar items using columns. However, since the banner is inside the navbar class, it extends the navbar too low.
img {
vertical-align: middle;
max-width: 100%;
max-height: 100%;
margin-bottom: 15px;
}
.homeBanner{
display: block;
margin-right: 0;
margin-left: 0;
z-index: 1;
width: 100%;
}
.purpleLogo{
position: absolute;
z-index: 2;
}
.hover:hover{
background-color: #754775;
}
.hover a{
text-decoration: none;
}
.navbar-nav {
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
}
.navbar-dark .navbar-nav .nav-link:focus,
.navbar-dark .navbar-nav .nav-link:hover {
color: #fff;
}
a.nav-link.dropdown-toggle.show {
background-color: #78496a;
transition: none;
}
.navbar-nav > li > .dropdown-menu {
margin-top: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.dropdown-menu > li > a {
display: block;
padding: 3px 20px;
clear: both;
font-weight: normal;
line-height: 1.42857143;
color: #333;
white-space: nowrap;
font-size: 14px;
}
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
background-color: #f5f5f5;
}
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/js/bootstrap.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar-expand-sm navbar-dark bg-dark">
<div class="container">
<div class="row">
<div class="col-2">
<img id="purpleLogo" src="https://www.ogm.utah.gov/coal/images/purpleLogo.png" />
</div>
<div class="col-10">
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">HOME</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li>Division Home</li>
<li>Oil and Gas Program Home</li>
</ul>
</li>
<li class="nav-item dropdown">
ABOUT US
<ul class="dropdown-menu scrollable-menu" role="menu">
<li>About Us</li>
<li>Mission Statement</li>
<li>Responsibilities</li>
</ul>
</li>
<li class="dropdown">
DATA RESEARCH CENTER
<ul class="dropdown-menu scrollable-menu" role="menu">
<li>Data Research Center Home</li>
<li>Data Explorer</li>
<li>LiveData Search</li>
<li>Electronic Reporting</li>
</ul>
</li>
<li class="nav-item"><a class="nav-link" href="http://localhost:1234/Utah_OG_Website/forms.php">FORMS</a></li>
<li class="nav-item"><a class="nav-link" href="http://localhost:1234/Utah_OG_Website/statistics.php">STATISTICS</a></li>
<li class="dropdown">
QUICK REFERENCES
<ul class="dropdown-menu scrollable-menu" role="menu">
<li>Well Bonding</li>
<li>Drilling Permits</li>
</ul>
</li>
<li class="dropdown">
OTHER LINKS
<ul class="dropdown-menu scrollable-menu" role="menu">
<li>Oil and Gas Associations</li>
<li>For Students and Teachers</li>
<li>Utah DNR</li>
<li>Utah.gov</li>
</ul>
</li>
<li class="nav-item"><a class="nav-link" href="http://localhost:1234/Utah_OG_Website/orphanWells.php">ORPHAN WELL PROGRAM</a></li>
</ul>
</div>
</div>
</div>
</div>
</nav>
I was able to solve my problem. There were a couple of things I had to do:
I ended up not needing to use the row class nor the column classes.
In my styles.css file, purpleLogo was labeled as a class when it was supposed to be an id.
I had to give #navbarSupportedContent a left margin of 224px so the navbar links didn't overlap the banner.
I had to give #purpleLogo a top position of 0px.
I had to remove the .img class and assign these properties to individual ids.
#homeBanner{
display: block;
margin-right: 0;
margin-left: 0;
z-index: 1;
width: 100%;
}
#purpleLogo{
position: absolute;
top: 0px;
}
#navbarSupportedContent {
margin-left: 224px;
}
.hover:hover{
background-color: #754775;
}
.hover a{
text-decoration: none;
}
.navbar-nav {
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
}
.navbar-dark .navbar-nav .nav-link:focus,
.navbar-dark .navbar-nav .nav-link:hover {
color: #fff;
}
a.nav-link.dropdown-toggle.show {
background-color: #78496a;
transition: none;
}
.navbar-nav > li > .dropdown-menu {
margin-top: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.dropdown-menu > li > a {
display: block;
padding: 3px 20px;
clear: both;
font-weight: normal;
line-height: 1.42857143;
color: #333;
white-space: nowrap;
font-size: 14px;
}
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
background-color: #f5f5f5;
}
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/js/bootstrap.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar-expand-sm navbar-dark bg-dark">
<div class="container">
<img id="purpleLogo" src="https://minerals.ogm.utah.gov/images/purpleLogo.png" />
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">HOME</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li >Division Home</li>
<li>Oil and Gas Program Home</li>
</ul>
</li>
<li class="nav-item dropdown">
ABOUT US
<ul class="dropdown-menu scrollable-menu" role="menu">
<li>About Us</li>
<li>Mission Statement</li>
<li>Responsibilities</li>
<li>Staff</li>
<li>Emergencies</li>
<li>Email Us</li>
<li>O&G Facts</li>
</ul>
</li>
<li class="dropdown">
DATA RESEARCH CENTER
<ul class="dropdown-menu scrollable-menu" role="menu">
<li>Data Research Center Home</li>
<li>Data Explorer</li>
<li>LiveData Search</li>
<li>Electronic Reporting</li>
</ul>
</li>
<li class="nav-item"><a class="nav-link" href="http://localhost:1234/Utah_OG_Website/forms.php">FORMS</a></li>
<li class="nav-item"><a class="nav-link" href="http://localhost:1234/Utah_OG_Website/statistics.php">STATISTICS</a></li>
<li class="nav-item"><a class="nav-link" href="https://oilgas.ogm.utah.gov/oilgasweb/live-data-search/lds-files/files-main.xhtml">WELL FILES</a></li>
<li class="nav-item"><a class="nav-link" href="https://oilgas.ogm.utah.gov/oilgasweb/live-data-search/lds-logs/logs-main.xhtml">WELL LOGS</a></li>
<li class="nav-item"><a class="nav-link" href="http://localhost:1234/Utah_OG_Website/noticesAndUpdates.php">NOTICES</a></li>
<li class="nav-item"><a class="nav-link" href="http://localhost:1234/Utah_OG_Website/rules.php">RULES AND STATUTES</a></li>
<li class="nav-item"><a class="nav-link" href="http://localhost:1234/Utah_OG_Website/publications.php">PUBLICATIONS</a></li>
<li class="nav-item"><a class="nav-link" href="http://localhost:1234/Utah_OG_Website/wellSpacingBoardOrders.php">WELL SPACING</a></li>
<li class="nav-item"><a class="nav-link" href="http://localhost:1234/Utah_OG_Website/mapResources.php">MAP RESOURCES</a></li>
<li class="dropdown">
QUICK REFERENCES
<ul class="dropdown-menu scrollable-menu" role="menu">
<li>Well Bonding</li>
<li>Drilling Permits</li>
<li>Drilling a Well</li>
<li>Operator Changes</li>
<li>Reporting</li>
</ul>
</li>
<li class="dropdown">
OTHER LINKS
<ul class="dropdown-menu scrollable-menu" role="menu">
<li>Oil and Gas Associations</li>
<li>For Students and Teachers</li>
<li>Government Agencies</li>
<li>Industry Information and Research</li>
<li>Oil and Gas Pricing</li>
<li>Some of Utah's Top Oil and Gas Producers</li>
<li>DOGM Board Members</li>
<li>Utah DNR</li>
<li>Utah.gov</li>
</ul>
</li>
<li class="nav-item"><a class="nav-link" href="http://localhost:1234/Utah_OG_Website/orphanWells.php">ORPHAN WELL PROGRAM</a></li>
<li class="nav-item"><a class="nav-link" href="http://localhost:1234/Utah_OG_Website/aboutUs.php#emergencies">EMERGENCIES</a></li>
<li class="nav-item"><a class="nav-link" href="http://localhost:1234/Utah_OG_Website/permittingReview.php">PERMITTING</a></li>
<li class="nav-item"><a class="nav-link" href="http://localhost:1234/Utah_OG_Website/inspectionsReview.php">INSPECTIONS</a></li>
</ul>
</div>
</div>
</nav>
<img id="homeBanner" src="https://minerals.ogm.utah.gov/images/MINERALSmainSmall.jpg" />

search button to open search box in bootstrap navbar

I want to add search box to my navbar but not as the traditional way as appears in the picture , I want to add a search icon button in the navbar only and when user click on it the search box appears under the search icon .
How can i do this any one can help me please ?
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<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="#">Brand</a>
</div>
<div class="collapse navbar-collapse" >
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>Contact US</li>
<li class="dropdown">
Who we are <b class="caret"></b>
<ul class="dropdown-menu">
<li>About</li>
<li> Mession</li>
<li> Vision</li>
<li class="divider"></li>
<li>Goals</li>
</ul>
</li>
<li>Publications</li>
<li>Media</li>
<li>Partners</li>
</ul>
There are lot of things on the net e.g https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_anim_search
Run below code:
<!DOCTYPE html>
<html>
<head>
<style>
input[type=text] {
width: 130px;
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
font-size: 16px;
background-color: white;
background-image: url('https://www.w3schools.com/howto/searchicon.png');
background-position: 10px 10px;
background-repeat: no-repeat;
padding: 12px 20px 12px 40px;
-webkit-transition: width 0.4s ease-in-out;
transition: width 0.4s ease-in-out;
}
input[type=text]:focus {
width: 100%;
}
</style>
</head>
<body>
<p>Animated search form:</p>
<form>
<input type="text" name="search" placeholder="Search..">
</form>
</body>
</html>
You can try these snippets.
Solutuion with CSS Only:
.hide
{
opacity: 0;
max-height: 0;
}
#trigger {
position: absolute;
left: -999em;
}
#container input[type="checkbox"]:checked + div
{
max-height: 99em;
opacity: 1;
height: auto;
overflow: hidden;
}
<div id="container">
<label for="trigger">click me for Search</label>
<input type="checkbox" id="trigger">
<div class="hide">
<form>
<input type="text" name="search" placeholder="Search..">
</form>
</div>
<div>
Solution with JS:
function myFunction() {
if (document.getElementById("form").style.display === "none") {
document.getElementById("form").style.display = "block";
} else {
document.getElementById("form").style.display = "none";
}
}
button {
width: 50px;
height: 50px;
}
<p>show and hide search</p>
<button onclick="myFunction()"></button>
<form id="form">
<input type="text" name="search" placeholder="Search..">
</form>

How to add line-separator in navbar?

I need to add separators between the links. Took navbar from boostrap3 components. Tried to use border-left, but failed. Broke my brain with this simple problem. Would be very thankful for any help.
.navbar-default {
z-index: 2;
text-transform: uppercase;
background-color: #cb5a3d;
}
.navbar-default .navbar-nav li > a {
margin-right: 100px;
padding: 25px 0;
color: #FFFFFF;
font-family: "FiraSans-bold", sans-serif;
}
.navbar-default .navbar-nav li:first-child {
margin-left: 100px;
<nav class="navbar navbar-default">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<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>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>о компании
</li>
<li>услуги
</li>
<li>новости
</li>
<li>полезная информация
</li>
<li>контакты
</li>
</ul>
</div>
<!-- end navbar-collapse -->
</nav>
<!-- end navbar -->

bootstrap navbar - show only submenu on mobile

I have a standard bootstrap navbar, that collapse on mobile. Here below the code, for your reference:
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">WebSiteName</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Menu with dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li>Submenu voice 1</li>
<li>Submenu voice 2</li>
<li>Submenu voice 3</li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
I would like, after clicking on the hamburger menu on mobile, to get directly the 3 <li> "Submenu voice x" and hide the parent <li> (class="dropdown").
How can I achieve this result? Thank you
You can use CSS for this:
#media (max-width: 767px) {
.navbar-nav .dropdown-menu {
display: block;
position: static;
float: none;
width: auto;
margin-top: 0;
background-color: transparent;
border: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
.dropdown-toggle {
display: none !important;
}
.navbar-inverse .navbar-nav .dropdown-menu > li > a {
color: #9d9d9d;
}
}
CODEPEN
I had to add the below to .navbar-nav .dropdown-menu in order to make it work.
opacity:1;
visibility: visible;
Try below code.
HTML:
<nav class="main-menu navbar-expand-md">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent1" aria-controls="navbarSupportedContent1" aria-expanded="false" aria-label="Toggle navigation">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="navbar-collapse collapse clearfix" id="navbarSupportedContent1">
<ul class="navigation clearfix">
<li class="current dropdown"><a routerLink="/">Home</a>
</li>
<li class="dropdown">About
<ul class="dropdown-menu">
<li>Company Overview</li>
<li>Vision Mission</li>
<li>Ethics & Core Values</li>
</ul>
</li>
</ul>
</div>
</nav>
CSS:
.dropdown:hover > .dropdown-menu{
display: block;
}

Align item in bootstrap navbar

I'm absolutly stacked while trying to align item in bootstrap navbar vertically on both desctop and mobile view.
Does anybody can explain how to di it?
I need to align avatar and name to right side on desctop and mobile and centerd vertially in navbar.
Here the HTML code:
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#main-nav">
<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 logo" href="#"><b>Super</b> logo</a>
</div>
<div class="nav navbar-nav navbar-right">
<ul class="unstyled">
<li>
<a href="/profile">
<img class="img-rounded" src="http://lorempixel.com/output/people-q-c-150-150-9.jpg" alt="">
<span class="hidden-xs">User name</span>
</a>
</li>
</ul>
</div>
<div class="navbar-collapse collapse" id="main-nav">
<ul class="nav navbar-nav visible-xs">
<li><i class="fa fa-tachometer"></i> menu 1</li>
<li><i class="fa fa-wrench"></i> menu 2</li>
<li><i class="fa fa-sign-out"></i> menu 3</li>
</ul>
</div>
</div></nav>
and CSS
.navbar-toggle {
position: absolute;
left: 10px;
}
.logo {
width: 100%;
padding: 15px 0;
text-align: center;
height: 20px;
}
.img-rounded {
height: 35px;
width: 35px;
border-radius: 50%;
}
.unstyled li {
list-style: none;
}
.unstyled a {
text-decoration: none;
}
#media only screen and (min-width: 768px) {
.logo {
width: 150px;
}
}
Here is a wrong eximple.
http://www.bootply.com/zh0J2u4KUU
updated use this
#media (max-width: 767px)
{
ol, ul{margin-top:6px; margin-right:302px;
}
<ul class="unstyled pull-right">
<li>
*******
</li>
</ul>
change the logo class to pull-right!