Bootstrap 5 How to change the blue color border to a different color from dropdown menu when you click on "Dropdown" - drop-down-menu

I am using Bootstrap 5. I am trying to change the blue color border to a different color from dropdown menu when you click on "Dropdown" I tried to change it in the css, but it is not overriding the blue border. I would appreciate any suggestions.
picture of dropdown blue border
Here is a link: https://www.codeply.com/p/PI41011ti0
<nav class="navbar navbar-expand navbar-dark bg-dark d-none d-md-flex" aria-label="navigation bar">
<div class="container-fluid">
<ul class="navbar-nav">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Dropdown</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a class="dropdown-item" href="#">Link 1</a></li>
<li><a class="dropdown-item" href="#">Link 2</a></li>
</ul>
</li>
</ul>
</div>
</nav>

Here, It is outline of element when click on. You can hide or change color with below css for that.
For Change Outline Color:
.nav-link:focus {
outline-color: #ffffff;
outline-style: solid;
}
For Hide Outline:
.nav-link:focus {
outline: 0;
}
You can refer for more details here: https://www.w3schools.com/cssref/pr_outline-color.asp

Related

Page content moves behind sidebar, Bootstrap

I've written a sidebar using Bootstap 5 which is placed on my _Layout view. The issue I'm having is when I load a new page like a users view, initialy it looks great, until I resize my screen and then the content on the users view slides behind the sidebar. I've tried placing the sidebar in a new column and row, etc but nothing I do seems to fix this. Below is my sidebar code, any help on this issue will be greatly appreciated.
<!-- Side Nav-->
<div class="container-fluid">
<div class="row">
<nav class="sidebar card py-2 mb-4 col-2 float-start vh-100 rounded-0 position-fixed" style="background-color: rgb(95,131,183);
width: 250px; padding-left: 0px; padding-right: 0px">
<ul class="nav flex-column" id="nav_accordion">
<li class="nav-item border-bottom">
<a class="nav-link bi bi-house" asp-area="" asp-controller="Home" style="color:whitesmoke; padding-left: 10px"> Home </a>
</li>
<li class="nav-item border-bottom">
<a class="nav-link bi bi-gear" href="#" style="color:whitesmoke; padding-left: 10px"> Settings </a>
</li>
<li class="nav-item border-bottom">
<a class="nav-link bi bi-speedometer" href="#" style="color: whitesmoke; padding-left: 10px"> Dashboard </a>
</li>
<li class="nav-item has-submenu border-bottom">
<a class="nav-link bi bi-people" href="#" style="color: whitesmoke; padding-left: 10px"> Contacts </a>
<ul class="submenu collapse" style="padding-left: 0px; padding-right: 0px">
<li><a class="nav-link" asp-area="" asp-controller="Users" asp-action="UsersIndex" style="color: whitesmoke"> Users </a></li>
<li><a class="nav-link" href="#" style=" color: whitesmoke"> Customers </a></li>
<li><a class="nav-link" href="#" style=" color: whitesmoke"> Suppliers </a></li>
</ul>
</li>
#* <li class="nav-item">
<a class="nav-link" href="#"> Something </a>
</li>
<li class="nav-item">
<a class="nav-link" href="#"> Other link </a>
</li>*#
</ul>
</nav>
</div>
</div
Many thanks
AJ

dropdown menu not work correctly - bootswatch cosmo

<div class="collapse navbar-collapse" id="navbarColor01">
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="nav-item dropdown show">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Dropdown</a>
<div class="dropdown-menu show" x-placement="bottom-start" style="position: absolute; transform: translate3d(0px, 38px, 0px); top: 0px; left: 0px; will-change: transform;">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Separated link</a>
</div>
</li>
</ul>
</div>
In cosmo bootswatch [boostrap theme] js for dropdown menu not work!?
as you see in up image, menu only droped down!
I run it on localhost
I see other posts on stack but not worked for me
fixed;
add two script tag in end of layout :
#RenderSection("scripts", required: false)
<script src="https://bootswatch.com/_vendor/popper.js/dist/umd/popper.min.js"></script>
<script src="https://bootswatch.com/_vendor/bootstrap/dist/js/bootstrap.min.js"></script>
</body>

Dropdown menu won't extend beyond navbar in xs size viewport

First ever question on here so go easy... (can you smell fear through the internet??) Okay, so my dropdown menu works fine in a desktop size viewport but viewing it through developer tools in mobile size it gets clipped and won't extend beyond the bottom of the nav div. What gives, yo? Here's the code, which I understand is the accepted protocol...
<!--start of navbar-->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container-fluid"><!--stretches navbar full width of screen-->
<div class="navbar-header">
<!--hamburger collapse menu-->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span><!--sr-only is for people with vision impairment-->
<span class="icon-bar"></span><!--triple lines on burger menu-->
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="homelink navbar-brand" href="#">Michael Amos</a>
</div> <!--/nav header-->
<div class="collapse navbar-collapse"> <!--make navbar list collapse when resize for small screen-->
<ul class="nav navbar-nav navbar-right"><!--applies bootstrap styling to float navbar items right-->
<li>about</li>
<li>contact</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">work<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>example 1</li>
<li>example 2</li>
<li>example 3</li>
</ul>
</li>
<li>FAQ</li>
</ul>
</div> <!--/nav collapse-->
</div> <!--/container-fluid-->
</nav> <!--/navbar-->
Muchas gracias!

How to create nested dropdown in drodown item of navbar menu with bootstrap 3?

friends!
Is there any opportunity to create nested dropdown(multilevel dropdown) inside of dropdown menu item with bootsrap 3? Here is http://jsfiddle.net/kkqxgfk6/1/ what i'm trying to do. May be I made mistake somewhere in the code, is that so?
Here is the html-code:
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- 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"> <span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</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 class="dropdown">
Dropdown <span class="caret"></span>
<ul class="dropdown-menu" role="menu">
<li class="dropdown">
Dropdown2 <span class="caret"></span>
<ul class="dropdown-menu" role="menu">
<li ><a href="#" >Something</a>
</li>
<li>Another action
</li>
<li>Something else here
</li>
<li class="divider"></li>
<li>Separated link
</li>
</ul>
</li>
<li>Another action
</li>
<li>Something else here
</li>
<li class="divider"></li>
<li>Separated link
</li>
</ul>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
The nested "Dropdown2" menu item cann't be opened like its parent menu item called "Dropdown"
Add all bold content into your code.
<ul class="dropdown-menu" role="menu" **onclick="event.stopPropagation();"**>
<li class="dropdown" **id="test"**>
Dropdown2 <span class="caret"></span>
Add this code into javascript.
$( "#test1" ).click(function() {
$(this).attr("aria-expanded", "true");
$('#test').addClass("open");
});
Reasons for your problem By default when you click inside dropdown it closes.
here we are adding classes dynamically to second dropdown list.
Create one more CSS file and define "Dropdown-submenu" class.
Apply this "Dropdown-submenu" class to your inner "LI" tag as:
<ul class="nav navbar-nav">
<li class="dropdown">
Dropdown <span class="caret"></span>
<ul class="dropdown-menu" role="menu">
<li class="dropdown dropdown-submenu">
Dropdown2 <span class="caret"></span>
<ul class="dropdown-menu" role="menu">
<li ><a href="#" >Something</a>
</li>
<li>Another action
</li>
<li>Something else here
</li>
<li class="divider"></li>
<li>Separated link
</li>
</ul>
</li>
The CSS file Will define Dropdown-submenu as:
.dropdown-submenu {
position:relative; } .dropdown-submenu>.dropdown-menu {
top:0;
left:100%;
margin-top:-6px;
margin-left:-1px;
-webkit-border-radius:0 6px 6px 6px;
-moz-border-radius:0 6px 6px 6px;
border-radius:0 6px 6px 6px; } .dropdown-submenu:hover>.dropdown-menu {
display:block; } .dropdown-submenu>a:after {
display:block;
content:" ";
float:right;
width:0;
height:0;
border-color:transparent;
border-style:solid;
border-width:5px 0 5px 5px;
border-left-color:#333333;
margin-top:5px;
margin-right:-10px; } .dropdown-submenu:hover>a:after {
border-left-color: #999999; } .dropdown-submenu.pull-left {
float:none; } .dropdown-submenu.pull-left>.dropdown-menu {
left:-100%;
margin-left:10px;
-webkit-border-radius:6px 0 6px 6px;
-moz-border-radius:6px 0 6px 6px;
border-radius:6px 0 6px 6px; }

bootstrap float image center of nav

OK I have accomplished this without bootstrap
<nav id="active">
<ul>
<li>Home</li>
<li>Ministries</li>
<li>Bylaws</li>
<li>About Us
<ul>
<li>History of RK</li>
<li>Mission Statement</li>
<li>Prayer Request</li>
</ul>
</li>
<li>Testimonials</li>
<li>Contact</li>
</ul>
<div class="img"></div>
</nav>
I am wanting to convert the current site to bootstrap and I am unable to find exactly how to do this. The image basically is floating in the middle of the navigation, that way it will allow me to make the image slightly larger in height that the navbar. Currently this is how I have it, the image isn't floating in the center it is styled there. which isnt the way I want it.. again like the image to be bigger than the menu height wise.
<div class="span12">
<nav class="navbar nav-center navbar-inverse">
<div class="navbar-inner">
<ul class="nav">
<li>Home</li>
<li>Minitries</li>
<li>Bylaws</li>
</ul>
<ul class="nav pull-right">
<li>About Us</li>
<li>Testimonies</li>
<li>Contact Us</li>
</ul>
<div class="navbar">
<img src="images/logo.png" width="115" height="135" alt=""/>
</div>
</div>
</nav>
</div>
****Ok quick edit... If you view this site. www.risenkings.com, if you notice that the logo image is floating in the middle of navbar. This is what I am trying to accomplish within bootstrap.
I would start by using just the standard navbar markup. Links will automatically float left, so your Home, Ministries and Bylaws can just be wrapped in a ul with 'nav navbar-nav' classes. For the remaining links, you'll want to wrap them in a separate ul adding the navbar-right class as well.
You can repurpose the navbar-brand class for your logo. Remembering that Bootstrap is a mobile first framework, you'll probably want to first style your logo to be on the left within the navbar for your "collapsed" menu style. I just sized your logo generally and adjusted the padding. You can tweak it how you like.
Once the menu is not collapsed (on viewports that are greater than 768px), you'll need to use a media query to position your navbar, and position and center your logo. Using position absolute on the wrapping navbar-brand with the right and left properties to 0, then setting the img inside to display block with margin auto is one way to do this. The demo shows the basic results.
DEMO
HTML:
<nav class="navbar navbar-inverse" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navcollapse">
<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="#"><img src="http://www.risenkings.com/images/logo.png" alt="logo" /></a>
</div>
<div class="collapse navbar-collapse" id="navcollapse">
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>Minitries</li>
<li>Bylaws</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
About Us
<ul class="dropdown-menu" role="menu">
<li>History</li>
<li>Mission</li>
<li>Requests</li>
</ul>
</li>
<li>Testimonials</li>
<li>Contact Us</li>
</ul>
</div><!-- /.navbar-collapse -->
</div>
</nav>
CSS:
.navbar-brand {
padding-top: 2px;
}
.navbar-brand>img {
width: 3em;
}
#media (min-width: 768px) {
.navbar {
margin-top: 4em;
}
.navbar-brand {
position: absolute;
top: -2em;
left: 0;
right: 0;
}
.navbar-brand>img {
width: 6em;
margin: 0 auto;
display: block;
}
}

Resources