Navbar Item Order with Bootstrap CSS - html

I got a different problem. My Navbar order is gone backward. So I changed code order to 3-2-1 instead of 1-2-3 for showing 1-2-3. This is my code
<div class="collapse navbar-collapse" id="navbar-ex-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
aria-expanded="false">Hesap <i class="fa fa-caret-down"></i></a>
<ul class="dropdown-menu" role="menu">
<li>
Ayarlar
</li>
<li class="divider"></li>
<li>
<a>Bilgisayara Son Erişim : 22:22:39 - 10.07.2015</a>
</li>
<li>
Çıkış Yap : scrappy#kodevreni.com
</li>
</ul>
</li>
</ul>
<a class="btn btn-link navbar-btn navbar-right">Kayıtlar</a>
<a class="btn btn-link navbar-btn navbar-right">Ekran Görüntüsü</a>
<a class="btn btn-link navbar-btn navbar-right">Yönetim</a>
</div>
I want to make it like this "Yönetim > Ekran Görüntüsü > Kayıtlar > Hesap (dropdown)". But It makes it backward so I changed the code upside down. But the problem is it shows as normal in mobile drop down button...

You can define your a tag float right as like this .
a.btn.btn-link.navbar-btn.navbar-right{float:right;}
<a class="btn btn-link navbar-btn navbar-right">Kayıtlar</a>
<a class="btn btn-link navbar-btn navbar-right">Ekran Görüntüsü</a>
<a class="btn btn-link navbar-btn navbar-right">Yönetim</a>

Hello please check this method it will work
<div class="dropdown">
<a id="dLabel" role="button" data-toggle="dropdown" class="btn btn-primary" data-target="#" href="/page.html">
Dropdown <span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>Yönetim</li>
<li>Ekran Görüntüsü</li>
<li>Kayıtlar</li>
<li role="separator" class="divider"></li>
<li class="dropdown-header"></li>
<ul class="dropdown-menu">
<li>Ayarlar</li>
<li>Kayıtlar</li>
<li>Bilgisayara Son Erişim : 22:22:39 - 10.07.2015</li>
<li>Çıkış Yap : scrappy#kodevreni.com</li>
</ul>
</div>

Related

How to wrap a Bootstrap 5 nav bar

I want my Bootstrap 5 nav to wrap until I get to a xs sized screen and then show the small screen pills. Currently it does not wrap and the menu disappears when xs; however, the pills do not appear. I have:
<nav id="myNavbarEP" class="navbar navbar-expand-lg navbar-expand-md navbar-sm navbar-xs navbar-light bg-light" style="display:none;">
<div class="container-fluid">
<div class="navbar-collapse collapse w-100 order-2 dual-collapse2">
<ul class="navbar-nav me-auto align-middle">
<li>
<a type="button" class="btn btn-colour1 nav-link dropdown-toggle align-middle" data-bs-toggle="dropdown" aria-expanded="false">Administration</a>
<ul class="dropdown-menu">
<li>
<a type="button" class="btn btn-colour1" href="BdyWghtMonAdmin.html">Body Weight Monitoring Frequency Administration</a>
</li>
<li>
<a type="button" class="btn btn-colour1" href="ClinicWorkingDay.html">Clinic Working Days</a>
</li>
<li>
<a type="button" class="btn btn-colour1" href="ClinicNonWorkingDate.html">Clinic Non Working Date</a>
</li>
<li>
<a type="button" class="btn btn-colour1" href="SupplementAdmin.html">Post-Training Supplement Aministration</a>
</li>
</ul>
</li>
<li class="nav-item active">
<a type="button" class="btn btn-colour1" href="AccountUpdate.html">Account Update</a>
</li>
<li class="nav-item active">
<a type="button" class="btn btn-colour1" href="CalendarSession.html">Calendar Session</a>
</li>
<li class="nav-item active">
<a type="button" class="btn btn-colour1" href="CalendarSessionSeries.html">Calendar Session Series</a>
</li>
<li class="nav-item">
<a type="button" class="btn btn-colour1" href="ExerciseAdmin.html">Exercise Library</a>
</li>
<li class="nav-item">
<a type="button" class="btn btn-colour1" href="ExerciseMachineAdmin.html">Exercise Machine Library</a>
</li>
<li class="nav-item">
<a type="button" class="btn btn-colour1" href="PatientExerciseAss.html">Exercise Prescription</a>
</li>
<li class="nav-item">
<a type="button" class="btn btn-colour1" href="SessionSelect.html">Gym Session</a>
</li>
<li class="nav-item">
<a type="button" class="btn btn-colour1" href="PatientIssues.html">Issues/Adverse Events</a>
</li>
<li class="nav-item">
<a type="button" class="btn btn-colour1" href="SessionSeriesAdmin.html">Session Series Admin</a>
</li>
</ul>
</div>
<div class="navbar-collapse collapse w-100 order-2 dual-collapse2">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a type="button" class="btn btn-info" href="HelpEP.html">Help</a>
</li>
<li class="nav-item">
<a type="button" class="btn btn-success" href="LoginRoleSelect.html">Select Role</a>
</li>
<li class="nav-item">
<a type="button" class="btn btn-danger" href="Login.html">Log out</a>
</li>
</ul>
</div>
</div>
</nav>
Add the flex-wrap class to the <ul>.

Sub drop down menu is not going in right direction

I am creating a sub dropdown and I want to make it open in the right direction but it is opening at the same position. When I am using left: 100% it is opening in the left direction and working correctly but not when using the right direction.
Here is the code:
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">
Action
<span class="caret"></span>
</button>
<ul class="dropdown-menu" style="margin-left:-70px;">
<li class="dropdown-submenu">
<a class="test" tabindex="-1" href="#">
<i class="fa fa-hand-o-left" aria-hidden="true" style="padding-right:10px;"></i>
Edit-file
</a>
<ul class="dropdown-menu" style="top: 0px;Right:100%;text-align:right;">
<li>action</li>
<li> sub action</li>
</ul>
</li>
</ul>
</div>
The dropdown menu is not opening in the right direction.
<style>right: 100%</style>

bootstrap dropdown not working in angularjs

I wanted to show a dropdown on click of the img icon but the dropdown is not opening on click, Here is my code.
<div class="dropdown">
<a href="javascript:void(0);" class="dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<span class="user-image" style="background-image: url('../images/rafi.jpg');"></span>
</a>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li>
<div class="profile-pic">
<img src="images/rafi.jpg" alt="Rafi Ali Khan">
</div>
</li>
<li>
<h3>{{$scope.userLocalData[0].uname}}</h3></li>
<li>Profile</li>
<li>Log Out</li>
</ul>
</div>
Your code contains some invalid HTML markup. For example, I assume you mean role="button" instead of type="button" for the anchor element. Also, you should use href="#" or data-target="#" instead of href="javascript:void(0);". You could try this:
<div class="dropdown">
<a href="#" class="dropdown-toggle" role="button" id="dropdownMenu1" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<span class="user-image" style="background-image: url('../images/rafi.jpg');"></span>
</a>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li>
<div class="profile-pic">
<img src="images/rafi.jpg" alt="Rafi Ali Khan">
</div>
</li>
<li><h3>{{$scope.userLocalData[0].uname}}</h3></li>
<li>Profile</li>
<li>Log Out</li>
</ul>
</div>

Bootstrap dropdown toggle with button group does not work in nav-bar

I am working on MVC 5 and using Bootstrap for my front end design. I have CSHTML layout pages in my shared folder. All the layouts contain a nav-bar that has several options in it. However, the btn-group within the <form class="navbar-form navbar-right"></form> does not show the dropdown menu. Here is the code snippet:
<form class="navbar-form navbar-right">
<ul class="nav navbar-nav navbar-right">
<li>
<div class="btn-group">
<button type="button" class="btn btn-link dropdown-toggle" data-toggle="dropdown">
<span class="glyphicon glyphicon-user"></span> #Session["emp_main_first"] <span class="caret"></span>
</button>
<!-- dropdown menu items-->
<ul class="dropdown-menu" role="menu">
<li><span class="glyphicon glyphicon-pencil"></span> Edit profile</li>
<li><span class="glyphicon glyphicon-cog"></span> Log out</li>
</ul>
</div>
</li>
</ul>
</form>
What is that I am missing out? Any help will be appreciated. Thanks in advance.
You can try the below code same as it is, it should work in your case.
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<form class="navbar-form navbar-right">
<ul class="nav navbar-nav navbar-right">
<li>
<div class="btn-group">
<button type="button" class="btn btn-link dropdown-toggle" data-toggle="dropdown">
<span class="glyphicon glyphicon-user"></span> #Session["emp_main_first"] <span class="caret"></span>
</button>
<!-- dropdown menu items-->
<ul class="dropdown-menu" role="menu">
<li><span class="glyphicon glyphicon-pencil"></span> Edit profile</li>
<li><span class="glyphicon glyphicon-cog"></span> Log out</li>
</ul>
</div>
</li>
</ul>
</form>
You can use <a></a> instead of <button></button>and apply css.
<div class="btn-group dropdown">
Dropdown
<ul class="dropdown-menu"></ul>
</div>
Hope this will work for you!
Give dropdown menu an ID and then call it from data-target
So,
<button type="button" class="btn btn-link dropdown-toggle" data-toggle="dropdown" data-target="#dropdown">
Then, call it with an ID from
<ul class="dropdown-menu" role="menu" id="dropdown">
This, looks for an ID on what to toggle (hence, menus to show).

Bootstrap's dropdown buttons not on the same row

I'm not sure what I'm doing wrong in my code here, but it's this or CSS related. I'm not sure what CSS setting this would be, but here is my navbar section of my html code.
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-expanded="true">
TTT Stats
<span class="caret"></span>
</button>
<a class="navbar-brand" href="index.php">Scoreboards</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
<li role="presentation"><a role="menuitem" tabindex="-1" href="index.php?page=tttkills">Total TTT Kills</a>
</li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="index.php?page=tttdeaths">Total TTT Deaths</a>
</li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="index.php?page=traitorkills">TTT kills as a traitor</a>
</li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="index.php?page=traitorskilled">Traitors killed as an innocent/detective</a>
</li>
</ul>
</div>
<div class="dropdown2">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-expanded="true">
Other
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu2">
<li role="presentation"><a role="menuitem" tabindex="-1" href="index.php?page=playtime">Time Tracker</a>
</li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="index.php?page=phkills">Total Prophunt Kills</a>
</li>
</ul>
</div>
(If anyone is wondering about the names, its for a garry's mod TTT server)
With that code, here is what the complete navbar looks like.
http://i.imgur.com/75cPTRh.png
I would want the two dropdown buttons side by side on that navbar. Now when they are like that, this leads into my next question tied into this. How do you work bootstrap's dropdown CSS if you have more than one button?
This is what I have in my css at the bottom to align the dropdown by the button, so that it is centered correctly below the button and not way over stuck to the left.
.dropdown-menu {
right: 68%;
left: 10%;
}
If there is more than one button, it still centers all buttons to that point on the page. How do I edit their positions individually?
Add btn-group class
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="index.php">Scoreboards</a>
</div>
<div class="btn-group">
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown">
TTT Stats <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li role="presentation"><a role="menuitem" tabindex="-1" href="index.php?page=tttkills">Total TTT Kills</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="index.php?page=tttdeaths">Total TTT Deaths</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="index.php?page=traitorkills">TTT kills as a traitor</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="index.php?page=traitorskilled">Traitors killed as an innocent/detective</a></li>
</ul>
</div>
<div class="btn-group dropdown2">
<button type="button" class="btn btn-default dropdown-toggle" id="dropdownMenu2" data-toggle="dropdown">
Other <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li role="presentation"><a role="menuitem" tabindex="-1" href="index.php?page=playtime">Time Tracker</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="index.php?page=phkills">Total Prophunt Kills</a></li>
</ul>
</div>
</div>
</div>
</nav>
To answer your first question,
you can place your dropdowns inside a structure like this
<div class="container">
<div class="row">
<div class="col-md-2"> <!-- markup for dropdown 1 --> </div>
<div class="col-md-2"> <!-- markup for dropdown 2 --> </div>
</div>
</div>
You can use col classes like these to make the layout of your page using bootstrap's grid system.
To learn more about them, visit:
http://getbootstrap.com/css/#grid