Bootstrap shadow not displaying on nav.shadow - html

I have a navigation bar component made with vue.js. I am styling the app with bootstrap so I have included bootstrap in the main html file.
I have built the navbar component and added the styling that I want but when I add the shadow or shadow-lg class the shadow does not appear at all. I have tried increasing the z-index of the navbar but the shadow still does not show.
<template>
<div class="row">
<div class="col">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark navbar-rounded shadow-lg" style="z-index: 100;">
<a class="navbar-brand" href="/">{{ logo_text }}</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="nav-item"
v-for="(item, index) in links"
:key="index"
>
<a :href="item.href" class="nav-link">{{ item.text }}</a>
</li>
</ul>
</div>
</nav>
</div>
</div>
</template>
Note that the class navbar-rounded is a custom class I added with the styling
.navbar-rounded {
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
How would I get the shadow to display correctly?

Shadow has been applied properly. There is no issue on applying styles.
I have created a JSFiddle, where I converted navbar to a lighter version. There you can see shadow is applied. The reason is due to dark theme applied, you can't see a color seperation between navbar background color and it's shadow color.
Clarify this issue by applying shadow, shadow-sm and shadow-lg classes on nav element.
Hope this will help to fix your issue.
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<div class="row">
<div class="col">
<nav class="navbar navbar-expand-lg navbar-light bg-light navbar-rounded shadow" style="z-index: 100;">
<a class="navbar-brand" href="/">{{ logo_text }}</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="nav-item"
v-for="(item, index) in links"
:key="index"
>
<a :href="item.href" class="nav-link">{{ item.text }}</a>
</li>
</ul>
</div>
</nav>
</div>
</div>

Related

How to fix the navbar toggle button not displaying items in Bootstrap 5.2

I have bootstrap 5.2.3 installed as an npm dependency in my angular application.
I am trying to add a toggle button in my navbar to display a list of list items when the page size is reduced.
<nav id="nav"
aria-label="Header"
class="navbar navbar-expand-lg mb-3">
<div class="container-fluid">
<a class="navbar-brand">
<em class="fa-solid fa-toolbox">
</em>
<span>App Name</span>
</a>
<button class="navbar-toggler" type="button"
data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbarSupportedContent"
aria-label="Menu Navigation"
class="collapse navbar-collapse">
<ul class="navbar-nav me-auto mb-2 mb-lg-0" role="tablist">
<ng-container *ngFor="let app of appList">
<li role="presentation"
class='nav-item'
routerLinkActive="active"
[routerLinkActiveOptions]="{exact: true}">
<a class="nav-link"
[routerLink]="app.routerLink"
(click)="selectApp(app.id)">
{{app.name}}
</a>
</li>
</ng-container>
</ul>
</div>
</div>
</nav>
<div class="row mt-2">
<div class="col">
<div *ngIf="notify" class="alert alert-success notification">
{{ notify }}
</div>
</div>
<router-outlet></router-outlet>
</div>
I have consulted Bootstrap's official documentation and tried to reverse-engineer my code using their template but the application refuses to display the list of items.
The only time it displays it is when I set my .navbar-toggler element's class to .show but this keeps the list open by default.

How to put navbar-brand to left and hamburger to right?

How can i put navbar-brand on the left and hamburger icon to the right? i tried floating in my css but it not working.. maybe because of the line that i marked on the code. In the photo is explained what i want to achieve. Explained
<nav class="navbar sticky-top navbar-expand-sm navbar-light">
<div class="row mx-auto">
<a class="navbar-brand" href="home.html">
<img src="Images/logo.png" width="65" height="50">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup"
aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
<a class="nav-item nav-link active" href="home.html">Почетна<span
class="sr-only">(current)</span></a>
<a class="nav-item nav-link" href="#">Информации</a>
<a class="nav-item nav-link" href="#">Контакт</a>
</div>
</div>
</div>
</nav>
You can use this bootstrap 4 navbar snippet
https://startbootstrap.com/snippets/navbar-logo/
or use float-left and float-right bootstrap classes
Use justify-content-between; Here's more info.
<nav class="... d-flex justify-content-between">
<!-- Your brand & content || [*****] link link link -->
<div class="...">
<div class="brand-logo">...</div>
<div class="hyperlinks">...</div>
</div>
<!-- Your menu -->
<div class="menu">...</div>
</nav>
add flex-direction: row-reverse; to .navbar. no need to float them.

How to customize a footer like bootstrap nav-bar?

I have a scenario where I need to display a footer just like navbar(i.e; need to hide list items of ul list using some button is responsive, on click of that button need to display list items), here I am using bootstrap navbar, but instead of hamburger I need some other customized button. Is it possible?
Here is my code:
<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>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active">list1</li>
<li>list2</li>
<li>list3</li>
</ul>
</div>
</div>
</nav>
Any help would be appreciated.
Thanks in Advance.
From Bootstrap documentation ... You should be able to change the icon here
https://getbootstrap.com/docs/4.0/components/navbar/
External content
Sometimes you want to use the collapse plugin to trigger hidden content elsewhere on the page. Because our plugin works on the id and data-target matching, that’s easily done!
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="pos-f-t">
<div class="collapse" id="navbarToggleExternalContent">
<div class="bg-dark p-4">
<h4 class="text-white">Collapsed content</h4>
<span class="text-muted">Toggleable via the navbar brand.</span>
</div>
</div>
<nav class="navbar navbar-dark bg-dark">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggleExternalContent" aria-controls="navbarToggleExternalContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
</nav>
</div>

issues with hamburger menu bootstrap

i have class for replacing my class container i called it container-mini
so far good not problem but when, in the mobile screen it have problem on hamburger menu like this
here my simple header code
<nav class="navbar navbar-toggleable-md navbar-light my-4" id="navna">
<div class="container-mini">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#site-nav" aria-controls="site-nav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand logona" href="/dusbam/id/">
<h1>LOGO</h1>
</a>
<div class="collapse navbar-collapse" id="site-nav">
<ul class="navbar-nav text-sm-left ml-auto">
<li class="nav-item">
<a class="nav-link" href="/dusbam/id/rooms">Kamar</a>
</li>
</ul>
</div>
</div>
</nav>
but when i replace container-mini with container it's fine like this
so my question is how to make hamburger menu like pict 2 without class container

Bootstrap 4 navbar - no height on mobile

How to set the bootstrap 4 navbar height in all viewport to 80px ?
I tried "min-height: 80px" in ".navbar" but the navbar is broken.
The sass code:
$navbar-bg: #26f3fd;
$navbar-height: 80px;
.navbar {
background-color: $navbar-bg;
min-height: $navbar-height;
}
The html code:
<nav class="navbar navbar-toggleable-md navbar-light bg-faded" id="main-navbar" data-toggle="sticky-onscroll">
<button class="navbar-toggler navbar-toggler-left" type="button" data-toggle="collapse" data-target="#navbar-content" aria-controls="navbar-content" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-md-center" id="navbar-content">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="<?= esc_url(home_url('/')); ?>">Accueil</a>
</li>
</ul>
</div>
http://codepen.io/juavenel/pen/xqMPrQ/
The issue is because your navbar doesn't contain a navbar-brand so it's height collapses when the navbar stacks vertically.
This is a known issue that will be fixed in the beta release: https://github.com/twbs/bootstrap/pull/22230
The workaround is to include an empty placehold navbar-text or navbar-brand..
<nav class="navbar navbar-toggleable-md navbar-light bg-faded py-3" id="main-navbar">
<button class="navbar-toggler navbar-toggler-left" type="button" data-toggle="collapse" data-target="#navbar-content" aria-controls="navbar-content" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<span class="navbar-text"> </span>
<div class="collapse navbar-collapse justify-content-md-center" id="navbar-content">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">Accueil</a>
</li>
</ul>
</div>
</nav>
http://www.codeply.com/go/FIKesgfDhL
Also, you can use vertical padding (py-3) instead to increase the height of the navbar and keep items vertically centered.