How to prevent Boostrap static-header's icon from being highlighted - html

I have a static HTML header that contains icons.
One icon uses Bootrap's navbar dropdown component.
My problem is, when I click on the user icon and select one of the dropdown menus, the user icon is also highlighted (replicates in the attached scriptlet when you click on "D" and move your cursor down a little).
How do I prevent the icon "D" from being highlighted after moving the cursor down a little?
<style> li.navbar-nav > a:hover,
li.navbar-nav > a:focus {
background-color: rgba(255, 255, 255, 0.2);
border-radius: 4px;
color: #ffffff;
opacity: 1;
}
.navbar.navbar-ct-blue {
background: #1B96BF;
border: 1px solid #1B96BF;
max-height: 50px;
line-height: 30px;
margin: 0;
}
.navbar.navbar-ct-blue .nav-justified > li {
display: table-cell;
width: 1%
}
.navbar.navbar-ct-blue .nav-justified > li > a {
color: white;
font-size: 30px;
}
.navbar.navbar-ct-blue .nav-justified > li > a:hover {
color: #00F2FF;
background: none;
}
.navbar.navbar-ct-green {
background: #1B96BF;
border: 1px solid #1B96BF;
max-height: 50px;
line-height: 30px;
margin: 0;
}
.navbar.navbar-ct-green .nav-justified > li {
display: table-cell;
width: 1%
}
.navbar.navbar-ct-green .nav-justified > li > a {
color: white;
font-size: 30px;
}
.navbar.navbar-ct-green .nav-justified > li > a:hover {
color: #00F2FF;
background: none;
}
.table {
margin-bottom: 60px;
}
</style>
<link href="http://themes-pixeden.com/font-demos/7-stroke/Pe-icon-7-stroke.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<!-- Fixed navbar -->
<nav class="navbar navbar-ct-green navbar-fixed-top" role="navigation">
<div class="container">
<ul class="nav nav-justified">
<li>
<a href="#">
<i class="pe-7s-timer"></i>A
</a>
</li>
<li class="navbar-nav">
<a href="#">
<i class="pe-7s-note2" style="color: white;"></i>B
</a>
</li>
<li class="navbar-nav">
<a href="#">
<i class="pe-7s-config" style="color: white;"></i>C
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<i class="pe-7s-user"></i> <span class="caret"></span>D
</a>
<ul class="dropdown-menu" background="blue">
<li>
Logout
</li>
<li>
Profile
</li>
</ul>
</li>
</ul>
</div>
</nav>

You can apply an inline style as background:none (or transparent) on last a class="dropdown-toggle"...> which is parent of your D element:
<li class="dropdown">
<a href="#" class="dropdown-toggle" style="background:none !important;" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
...
Edit:
another way is to define a css class like as noFocusBkg as following and apply it to containing li item as:
.noFocusBkg .dropdown-toggle:focus { /*** new class to prevent highlighting */
background: none; /* or transparent or inherit */
}
<li class="dropdown noFocusBkg">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
...
the full code snippet:
<style>
li.navbar-nav > a:hover,
li.navbar-nav > a:focus {
background-color: rgba(255, 255, 255, 0.2);
border-radius: 4px;
color: #ffffff;
opacity: 1;
}
.navbar.navbar-ct-blue {
background: #1B96BF;
border: 1px solid #1B96BF;
max-height: 50px;
line-height: 30px;
margin: 0;
}
.navbar.navbar-ct-blue .nav-justified > li {
display: table-cell;
width: 1%
}
.navbar.navbar-ct-blue .nav-justified > li > a {
color: white;
font-size: 30px;
}
.navbar.navbar-ct-blue .nav-justified > li > a:hover {
color: #00F2FF;
background: none;
}
.navbar.navbar-ct-green {
background: #1B96BF;
border: 1px solid #1B96BF;
max-height: 50px;
line-height: 30px;
margin: 0;
}
.navbar.navbar-ct-green .nav-justified > li {
display: table-cell;
width: 1%
}
.navbar.navbar-ct-green .nav-justified > li > a {
color: white;
font-size: 30px;
}
.navbar.navbar-ct-green .nav-justified > li > a:hover {
color: #00F2FF;
background: none;
}
.table {
margin-bottom: 60px;
}
.noFocusBkg .dropdown-toggle:focus { /*** new class to prevent highlighting */
background: none; /* or transparent or inherit */
}
</style>
<link href="http://themes-pixeden.com/font-demos/7-stroke/Pe-icon-7-stroke.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<!-- Fixed navbar -->
<nav class="navbar navbar-ct-green navbar-fixed-top" role="navigation">
<div class="container">
<ul class="nav nav-justified">
<li>
<a href="#">
<i class="pe-7s-timer"></i>A
</a>
</li>
<li class="navbar-nav">
<a href="#">
<i class="pe-7s-note2" style="color: white;"></i>B
</a>
</li>
<li class="navbar-nav">
<a href="#">
<i class="pe-7s-config" style="color: white;"></i>C
</a>
</li>
<li class="dropdown noFocusBkg">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<i class="pe-7s-user"></i> <span class="caret"></span>D
</a>
<ul class="dropdown-menu" background="blue">
<li>
Logout
</li>
<li>
Profile
</li>
</ul>
</li>
</ul>
</div>
</nav>

The highlighting is occurring on the :focus event. So you can prevent this by overriding Bootstrap's default :focus event, like so:
.nav > li > a:focus {
background-color: transparent;
}

Related

Change the nav-item background color not working

I want to change the background color of the active nav-item and of any nav-item hovered to "chartreuse" (just a color to test).
I've tried love of things but it's not working, why?
Not even using !important.
https://codepen.io/ogonzales/pen/abNQXLg
CSS:
/* NAVBAR TOP */
#top-navbar {
background-color: #1f1f1f;
}
.navbar-nav > .active > a {
color: aqua;
background-color: chartreuse;
}
.nav-item > a:hover {
color: aqua;
}
#navbarCollapse {
margin-left: 1%;
}
#navbarCollapse ul li {
display: inline-block;
}
.nav-link {
margin: 5px;
width: 100px;
}
/* start update */
nav ul {
margin-bottom: 0;
}
.navbar-light .navbar-toggler-icon {
background-image: none;
font-size: 25px;
height: auto;
width: auto;
padding: 3px;
}
#navbarCollapse ul {
padding-top: 10px
}
#navbarCollapse ul li a {
margin: 0;
padding: 5px 10px;
}
nav {
position: relative
}
nav form {
position: absolute;
top: 7px;
right: 15px;
}
Target the active nav-item like this:
.nav-item.active > a{
}
Then you can add css styling into it.
Before you weren't selecting the element properly.
What you desired:
.nav-item.active > a {
color: aqua;
}
.nav-item > a:hover {
background-color: chartreuse;
}
See codepen: https://codepen.io/koder613/pen/ZEWNEgw?editors=1100
To change the background color of the active nav-item. Call the navbar-nav class as it is in your ul tag as shown.
<div class="collapse navbar" id="navbarCollapse">
<!-- Call the navbar-nav class in the ul tag -->
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="/">Inicio</a>
</li>
<li class="nav-item">
<a href="/iglesias/" class="nav-link" >Iglesias</a>
</li>
<li class="nav-item">
<a href="/doctrina/" class="nav-link" >Doctrina</a>
</li>
</ul>
</div>
And the following will show the "chartreuse" color when you hover over the nav-items.
.nav-item > a:hover { color: aqua; background-color: chartreuse; }
I added active class on your second li to show how it looks like.
But more or less you should set your changing color in active class like:
.active{
background-color: red;
}
.active:hover > a{
color: yellow !important;
}
Like this both color will change when mouse is going hover your li with active class. And You add important where you want to make it stronger.
Pretty much duplicate of: Changing the color of active nav-item
$(document).ready(function() {
"use strict";
$('ul > li').click(function(e) {
e.preventDefault();
$('ul > li').removeClass('active');
$(this).addClass('active');
});
});
/* NAVBAR TOP */
#top-navbar {
background-color: #1f1f1f;
}
.navbar-nav > .active > a {
color: aqua;
background-color: chartreuse;
}
.active{
background-color: red;
}
.nav-item.active:hover > a{
color: yellow !important;
}
.nav-item > a:hover {
color: aqua;
}
#navbarCollapse {
margin-left: 1%;
}
#navbarCollapse ul li {
display: inline-block;
}
.nav-link {
margin: 5px;
width: 100px;
}
/* start update */
nav ul {
margin-bottom: 0;
}
.navbar-light .navbar-toggler-icon {
background-image: none;
font-size: 25px;
height: auto;
width: auto;
padding: 3px;
}
#navbarCollapse ul {
padding-top: 10px
}
#navbarCollapse ul li a {
margin: 0;
padding: 5px 10px;
}
nav {
position: relative
}
nav form {
position: absolute;
top: 7px;
right: 15px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<header>
<!--MENU SUPERIOR-->
<!-- Fixed navbar -->
<nav class="navbar navbar-expand-md navbar-light fixed-top" id="top-navbar">
<div class="container">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse"
aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<!-- <span class="navbar-toggler-icon"><i class="fas fa-bars"></i></span> -->
<span class="navbar-toggler-icon">
<i class="fas fa-bars" style="color:#fff; font-size:28px;"></i>
</span>
</button>
<a class="navbar-brand mr-auto mt-0" href="/"><img src="/static/img/logos/elim-palmera-la-central-fondo-blanco.png" width="25px"
height="30px"></a>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul>
<li class="nav-item">
<a class="nav-link" href="/">Inicio</a>
</li>
<li class="nav-item active">
<a href="/iglesias/" class="nav-link" >Iglesias</a>
</li>
<li class="nav-item">
<a href="/doctrina/" class="nav-link" >Doctrina</a>
</li>
</ul>
</div>
<form class="form-inline ml-auto mt-3">
<span class="text-white">Hola, ogonzales.</span>
Salir
</form>
</div>
</nav>
</header>

How to hover splitted button in Bootstrap 4 navbar

For a Bootstrap 4 website I've made a navbar with splitted dropdown buttons. The leftside of the dropdown button is a normal link and the rightside is a caret button to show the submenu.
For some reason I cannot find a working CSS way to have the hover effect only on the rightside (caret) and not on the leftside (link). Is there a CSS way (without Javascript) to do this?
Thanx in advance.
You'll find the jsfiddle on https://jsfiddle.net/bnsthp57/
Update
The hover is working! The updated snippet below is ready to use. Tested on Internet Explorer 11, Crhome 79, Opera 66, Edge 44, and Firefox 72.
#topnav .navbar-nav {
font-size: 0rem;
}
#topnav .nav-link {
display: inline-block;
padding: 0.625rem 1rem;
font-size: 1rem;
}
#topnav .dropdown-link {
padding: 0.625rem 0.25rem;
}
#topnav .dropdown-toggle {
padding-left: 0.25rem;
}
#media (max-width: 767.98px) {
#topnav .navbar-nav {
padding-top: 0.5rem;
}
#topnav .nav-link:first-child,
#topnav .dropdown-link {
display: block;
width: calc(100% - 50px);
padding: 0.625rem 1rem;
border-right: 1px solid #88d;
}
#topnav .dropdown-toggle {
display: block;
width: 50px;
padding: 0.625rem 0.5rem;
position: absolute;
top:0; right:0;
text-align: center;
}
}
#media (min-width: 768px) {
#topnav .nav-link {
border-right: 1px solid rgba(0, 0, 0, 0.1);
}
#topnav .dropdown-link,
#topnav .nav-item:last-child a.nav-link {
border-right: 0;
}
#topnav .dropdown-menu {
margin-top: 0;
}
#topnav .dropdown-toggle:hover + .dropdown-menu,
#topnav .dropdown-menu:hover {
display: block; /* open submenu on hover */
}
#topnav .dropdown-menu:not(:hover) {
display: none; /* close submenu on not hover */
}
}
/* navbar theme */
#navbar,
#navbar .navbar-toggler {
color: #fff;
background-color: #1c8cbc;
border-color: #1f90bb #1f90bb #145e7a;
}
#navbar .navbar-toggler-icon {
background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3e%3cpath stroke='rgba(255, 255, 255, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
#topnav .nav-link {
color: #fff;
background-color: transparent;
font-weight: 600;
}
#topnav .nav-link:hover {
background-color: rgba(0, 0, 0, 0.1);
}
#topnav .dropdown-menu,
#topnav .dropdown-item,
#topnav .dropdown-item:focus {
color: #fff;
background-color: #0c7cac;
}
#topnav .dropdown-item.active {
color: #ff6;
background-color: #0c7cac;
font-weight: 600;
}
#topnav .dropdown-item:hover,
#topnav .dropdown-item:active {
color: #fff;
background-color: #1383af;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<nav id="navbar" class="navbar navbar-expand-md mr-auto">
<div class="container">
<button class="navbar-toggler" type="button" data-toggle="collapse"
data-target="#topnav" aria-controls="topnav" aria-expanded="false"
aria-label="Toggle menu">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="topnav">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="#pagelink">Home</a>
</li>
<li class="nav-item dropdown active">
<a class="nav-link dropdown-link" href="#pagelink">Magazine</a>
<a class="nav-link dropdown-toggle" href="#" id="navlink01" role="button"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></a>
<div class="dropdown-menu" aria-labelledby="navlink01">
<a class="dropdown-item" href="#pagelink">Sub item 1</a>
<a class="dropdown-item active" href="#pagelink">Sub item 2</a>
<a class="dropdown-item" href="#pagelink">Sub item 3</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="index.php">Portfolio</a>
</li>
</ul>
</div>
</div>
</nav>
Navbar with splitted dropdown buttons
.dropdown-toggle:hover + .dropdown-menu{
display:block;
}
With this css it will work
#media (min-width: 768px) {
#topnav .dropdown-toggle:hover + .dropdown-menu,
#topnav .dropdown-menu:hover {
display: block;
}
#topnav .dropdown-menu:not(:hover) {
display: none;
}
}
on this dropdown nav-item
<li class="nav-item dropdown active">
<a class="nav-link dropdown-link" href="#pagelink">Magazine</a>
<a class="nav-link dropdown-toggle" href="#" id="navlink01" role="button"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></a>
<div class="dropdown-menu" aria-labelledby="navlink01">
<a class="dropdown-item" href="#pagelink">Sub item 1</a>
<a class="dropdown-item active" href="#pagelink">Sub item 2</a>
<a class="dropdown-item" href="#pagelink">Sub item 3</a>
</div>
</li>

How can i make the list appear on hover?

So I have this code:
.hoverlist12:hover #details {
display: block;
}
The thing is the list doesn't appear at all. If I change the hoverlist12 class with the ul, it works fine, but it appears when I hover on all the elements, and I want it to appear when I hover it only on the first "li". Usually, I have no problem doing this but now I just can't figure it out.
.navbar {
border-radius: 0;
max-height: 50px;
}
.navbar-default .navbar-nav > li > a,
.navbar-default .navbar-brand {
color: #ffffff;
}
.navbar-default .navbar-brand:hover {
color: #ffffff;
transform: scale(1.1);
}
.navbar-default .navbar-nav > li > a:focus,
.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-brand:focus,
.navbar-default .navbar-brand:hover {
color: #ffffff;
}
.navbar-default .navbar-nav > li:focus,
.navbar-default .navbar-nav > li:hover {
background-color: rgba(0, 0, 0, 0.15);
}
nav {
font-family: "ITCErasStd-Medium";
}
.hiddeOnTop {
visibility: hidden;
}
.container-fluid {
padding-right: 3%;
padding-left: 3%;
display: inline-block;
width: 100%;
}
.navbar-default,
.container-fluid {
background-color: #be3c7a;
}
.nav > li > a {
font-size: 1.1em;
}
.navbar .facebook {
padding: 0;
margin-top: 7px;
}
.navbar .facebook:hover {
background: none;
transform: scale(1.1);
}
.navbar-brand,
.nav > li.active > a {
font-family: "ITCErasStd-Bold";
}
#details {
padding: 26px 30px;
display: none;
color: white;
z-index: 900;
font-size: 2rem;
list-style-type: none;
position: absolute;
margin-top: 50px;
background-color: #be3c7a;
}
.hoverlist12:hover #details {
display: block;
}
<nav class="mobile_nav">
<button type="button">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<ul class="nav-content">
<li>
<a href="htps://www.facebook.com" alt="facebook" class="facebook"
><img
src="./img/fb-icon.svg"
alt="fb-icon"
onerror="this.src='./img/fb-icon.png'"
/></a>
</li>
<!-- <li class="homelk">HOME</li> -->
<li class="homelk">
CE ESTE adadsadassssss
</li>
<li>INTREBARI FRECVENTE</li>
<li>PARTENERI</li>
<li>CONTACT</li>
<!-- <li><i class="fa fa-facebook-official"></i></li> -->
</ul>
</nav>
<!-- //////////////////////////// NAVBAR \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\-->
<nav class="navbar navbar-default">
<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 navigate" href="#home"><span>HOssME</span></a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav navbar-right dropdown">
<li class="hoverlist12">
CE ESTE USCACIUNEA
</li>
<ul id="details">
<li>Manifestari</li>
<li>Femeia activa</li>
<li>Maternitatea</li>
<li>Menopauza</li>
<li>Sub tratament</li>
</ul>
<li> DE CE HAYLO GYN </li>
<li> INTREBARI </li>
<li>CONTACT</li>
<li>
<a href="htps://www.facebook.com" alt="facebook" class="facebook"
><img
src="./img/fb-icon.svg"
alt="fb-icon"
s
onerror="this.src='./img/fb-icon.png'"
/></a>
</li>
<!-- <li><i class="fa fa-facebook-official"></i></li> -->
</ul>
</div>
</div>
</nav>
Use selector like this: .hoverlist12:hover ~ #details Because #details and .hoverlist12 elements are siblings or at same level. You can use this selector only .hoverlist12:hover #details when #details is a child element of .hoverlist12. So, please change your CSS code as I suggested OR Please change your structure like:
<li class="hoverlist12">
CE ESTE USCACIUNEA
<ul id="details">
<li>Manifestari</li>
<li>Femeia activa</li>
<li>Maternitatea</li>
<li>Menopauza</li>
<li>Sub tratament</li>
</ul>
</li>

Align firstname and lastname on seperate lines in navbar

I have an example navbar that I wish to modify for my own here. Currently the user's fullname is positioned on the same line like so:
How do I change the fullname position so they are displayed and aligned like this:
I createed an un-ordered list, but I think that is semantically incorrect and we can't put a ul inside a link anyway. It also wasn't working in IE either, so I am back to square one.
Any ideas would be helpful.
body {
padding-top: 102px;
background-color: #4d4d4d;
font-family: 'Lato', verdana, sans-serif;
color: #010101;
}
.container {
width: 1530px;
margin-top: 0;
}
.navbar-fixed-top {
background-color: #fff;
}
.navbar-default .navbar-header {
min-height: 80px;
}
.navbar-default .navbar-header button.hamburger-icon {
margin-top: 20px;
}
.navbar-default .navbar-brand {
color: #010101;
padding-top: 5px;
}
/* searchbox */
.navbar-nav > .dropdown.search .input-group {
padding-top: 15px;
}
.navbar-nav > .dropdown.search .input-group input.form-control {
padding: 0 10px 0 0;
background-color: #fff;
color: #010101;
border-radius: 0;
border: 0;
box-shadow: none;
font-size: 16px;
font-weight: 100;
}
.navbar-nav > .dropdown.search .input-group input.form-control:hover {
background-color: #fff;
}
.navbar-nav > .dropdown.search .input-group-btn button {
padding: 2px;
border: 0;
box-shadow: none;
background-color: #fff;
border-radius: 0;
}
.navbar-nav > .dropdown.search .input-group-btn button:hover {
background-color: #fff;
color: #ff5500;
}
.navbar-nav > .dropdown.search .input-group-btn .glyphicon-search {
font-size: 22px;
}
/* bell notification and dropdown */
.navbar-default .navbar-nav > .open > a.inbox,
.navbar-default .navbar-nav > .open > a.inbox:focus,
.navbar-default .navbar-nav > .open > a.inbox:hover {
background-color: #fff;
padding-top: 15px;
margin-bottom: 5px;
}
.nav > li.dropdown.bell > a:hover,
.nav > li.dropdown.bell > a:focus {
color: #ff5500;
background-color: transparent;
}
.navbar-nav > .dropdown.bell li a:hover {
color: #ff5500;
background-color: transparent;
}
.navbar-nav > .dropdown.bell .badge-count {
background: #ff5500;
margin-top: -24px;
margin-left: -20px;
height: 1.7em;
}
.navbar-nav > li > .dropdown-menu.bell {
background-color: #f8f8f8;
border-radius: 0;
}
.navbar-nav > li > .dropdown-menu.bell li a {
padding-top: 5px;
padding-bottom: 5px;
white-space: normal !important;
width: 350px;
}
.navbar-nav > li > .dropdown-menu.bell li a span.info {
display: block;
padding: 0 5px 0 5px;
}
.navbar-nav > li > .dropdown-menu.bell li.divider {
padding: 0;
margin: 0 20px;
}
.navbar-nav > li > .dropdown-menu.bell .label {
background-color: transparent;
color: #aaa;
font-weight: 100;
}
/* bell notification and dropdown caret */
.navbar-nav > li > .dropdown-menu.bell:before {
position: absolute;
top: -10px;
right: 9%;
display: inline-block;
border-right: 10px solid transparent;
border-bottom: 10px solid #ccc;
border-left: 10px solid transparent;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}
.navbar-nav > li > .dropdown-menu.bell:after {
position: absolute;
top: -9px;
right: 9%;
display: inline-block;
border-right: 9px solid transparent;
border-bottom: 9px solid #f8f8f8;
border-left: 9px solid transparent;
content: '';
}
/* create profile button */
.navbar-nav > .dropdown.create-profile a.create-profile-btn {
width: 200px;
padding: 12px;
margin-top: 18px;
}
.navbar-nav > .dropdown.create-profile a.btn-default {
background-color: #ff5500;
border-color: #ff5500;
color: #fff;
}
.navbar-nav > .dropdown.create-profile a.btn-default:hover,
.navbar-nav > .dropdown.create-profile a.btn-default:focus,
.navbar-nav > .dropdown.create-profile a.btn-default:active {
color: #fff;
border-color: 0;
/*set the color you want here*/
}
/* user login and dropdown */
.navbar-nav > .user-logged-in span.firstname {
font-size: 16px;
color: #010101;
}
.navbar-nav > .user-logged-in span.surname {
font-size: 16px;
color: #010101;
}
.navbar-nav > .user-logged-in .dropdown-menu.access-list {
width: 100%;
border-radius: 0;
border: 0;
background-color: #f8f8f8;
font-size: 14px;
}
.navbar-nav > .user-logged-in .dropdown-menu.access-list li a {
margin: 5px 0px;
color: #010101;
}
.navbar-nav > .user-logged-in .dropdown-menu.access-list li a:hover {
background-color: transparent;
color: #ff5500;
}
.navbar-nav > .user-logged-in .dropdown-menu.access-list li.divider {
padding: 0;
margin: 0 20px;
}
.fullname {
float: right;
padding-right: 10px;
}
.drop-arr {
float: right;
padding-top: 10px;
}
span.avatar {
padding-right: 90px;
}
/* Large desktop */
#media (max-width: 1590px) {
.container {
width: auto;
}
}
/* Portrait tablet to landscape and desktop */
#media (max-width: 979px) {}
/* Landscape phone to portrait tablet */
#media (max-width: 768px) {
.container {
width: auto;
}
.navbar-default .navbar-brand {
font-size: 40px;
}
/* bell notification and dropdown */
.navbar-default .navbar-nav > .open > a.inbox,
.navbar-default .navbar-nav > .open > a.inbox:focus,
.navbar-default .navbar-nav > .open > a.inbox:hover {
width: 100% !important;
background-color: #e7e7e7;
margin-bottom: 0px;
}
.navbar-nav > li > .dropdown-menu.bell li a {
width: 100%;
}
.navbar-nav > li > .dropdown-menu.bell:before,
.navbar-nav > li > .dropdown-menu.bell:after {
display: none;
}
.navbar-nav > li > .dropdown-menu.bell li a {
text-align: left;
}
.navbar-nav > .dropdown.bell,
.navbar-nav > .user-logged-in {
text-align: center;
}
/* searchbox */
.navbar-nav > .dropdown.search {
padding-left: 10px;
padding-right: 10px;
margin-top: 0;
width: 100%;
overflow: hidden;
}
.navbar-nav > .dropdown.search .input-group {
padding-top: 0;
}
}
/* Landscape phones and down */
#media (max-width: 480px) {
.navbar-default .navbar-brand {
font-size: 30px;
}
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/js/bootstrap.min.js" integrity="sha384-vZ2WRJMwsjRMW/8U7i6PWi6AlO1L79snBrmgiDpgIWJ82z8eA5lenwvxbMV1PAh7" crossorigin="anonymous"></script>
<div class="container">
<div class="navbar navbar-default navbar-fixed-top navbar-md" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle hamburger-icon" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<h1>
<img src="logo.png" height="30" width="180">
</h1>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<!-- search bar -->
<li class="dropdown search">
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search name or keyword" name="q">
<div class="input-group-btn">
<button class="btn btn-default" type="submit">
<img src="https://cdn2.iconfinder.com/data/icons/ios-7-icons/50/search-128.png" height="30" width="30" class=" avatar-img img-square">
</button>
</div>
</div>
</form>
</li>
<!-- notification bell -->
<li class="dropdown bell">
<a href="#" class="dropdown-toggle inbox" data-toggle="dropdown">
<img src="https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-ios7-bell-outline-128.png" height="45" width="45" class=" avatar-img img-square">
<span class="badge badge-count">1</span>
</a>
<ul class="dropdown-menu bell" role="menu">
<li><span class="label label-default">4:00 AM</span><span class="info">Favourites Snippet</span>
</li>
<li class="divider"></li>
<li><span class="label label-warning">4:30 AM</span><span class="info">Email marketing</span>
</li>
<li class="divider"></li>
<li><a href="#"><span class="label label-warning">5:00 AM</span>
<span class="info">
Subscriber focused email design
Extra sample line
Extra sample line
Extra sample line
</span></a>
</li>
<li class="divider"></li>
<li>View All
</li>
</ul>
</li>
<!-- create profile button -->
<!-- <li class="dropdown create-profile">
<a class="btn btn-default btn-lg create-profile-btn" href="#" role="button">Create a profile</a>
</li> -->
<!-- user login information -->
<li class="dropdown user-logged-in">
<a href="#" class="dropdown-toggle username" data-toggle="dropdown">
<span class="avatar"><img src="https://cdn2.iconfinder.com/data/icons/ios-7-icons/50/user_male2-128.png" height="50" width="50" ></span>
<span class="drop-arr"><img src="https://cdn0.iconfinder.com/data/icons/slim-square-icons-basics/100/basics-08-128.png" height="20" width="20" ></span>
<span class="fullname">
<span class="firstname">Jacky</span>
<br><span class="surname">Smith</span>
</span>
</a>
<ul class="dropdown-menu access-list" role="menu">
<li>ssdfsdf
</li>
<li class="divider"></li>
<li>fsfsdfs
</li>
<li class="divider"></li>
<li>sfsfsf
</li>
<li class="divider"></li>
<li>fsdfsdsd
</li>
<li class="divider"></li>
<li>dlfjsdlfjs
</li>
</ul>
</li </ul>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12">
<p>dfsjfhskfs</p>
<!-- <div class="chevron right">
</div>
<div style="height: 1em;">
</div> -->
</div>
</div>
</div>
</div>
A simple </br> would do:
<span>First Name </br> <strong>Last Name<strong> </span>
.navbar-login {
width: 305px;
padding: 10px;
padding-bottom: 0px;
}
.navbar-login-session {
padding: 10px;
padding-bottom: 0px;
padding-top: 0px;
}
.icon-size {
font-size: 87px;
}
.glyphicon-user {
position: absolute !important;
margin: -5px 0 0;
left: 5px;
top: 50% !important;
}
.glyphicon-chevron-down {
position: absolute !important;
margin: -5px 0 0;
right: 5px;
top: 50% !important;
}
.dropdown .dropdown-toggle {
position: relative;
padding-right: 35px;
padding-left: 35px;
}
.name {
display: block;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/js/bootstrap.min.js" integrity="sha384-vZ2WRJMwsjRMW/8U7i6PWi6AlO1L79snBrmgiDpgIWJ82z8eA5lenwvxbMV1PAh7" crossorigin="anonymous"></script>
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a target="_blank" href="#" class="navbar-brand">My sApp.</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li>Inicio
</li>
<li class="active">Inspirado en este ejemplo
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">DropDown
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>Link 2
</li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle text-right username" data-toggle="dropdown">
<span class="glyphicon glyphicon-user"></span>
<span class="name">Nombre</span>
<strong class="name">lastname</strong>
<span class="glyphicon glyphicon-chevron-down"></span>
</a>
<ul class="dropdown-menu">
<li>
<div class="navbar-login">
<div class="row">
<div class="col-lg-4">
<p class="text-center">
<span class="glyphicon glyphicon-user icon-size"></span>
</p>
</div>
<div class="col-lg-8">
<p class="text-left"><strong>Nombre Apellido</strong>
</p>
<p class="text-left small">correoElectronico#email.com</p>
<p class="text-left">
Actualizar Datos
</p>
</div>
</div>
</div>
</li>
<li class="divider"></li>
<li>
<div class="navbar-login navbar-login-session">
<div class="row">
<div class="col-lg-12">
<p>
Cerrar Sesion
</p>
</div>
</div>
</div>
</li>
</ul>
</li>
</ul>
</div>
</div>
You can do this by changing a little bit the structure of this :
<span class="nombre">
<span>Nombre</span>
<span><strong>lastname</strong></span>
</span>
And the relevant CSS :
.username .nombre {width: 75px; display: inline-block; text-align: right; margin-right: 10px;}
.glyphicon { vertical-align: top; padding-top: 15px; }
.glyphicon:first-child { padding-top: 10px}
See this fiddle
<span style="float:right">Nombre</span>
<p class="clear">
<span style="float:right"><strong>lastname</strong></span>
in css add
clear: both;
height: 0;
margin: 0;
padding: 0;
and use it in situations like this :)
you could also use something like this
<span style="float:right">Nombre</span>
<br/>
<span style="float:right"><strong>lastname</strong></span>
but i think that will separate them too much

In navbar glyphicon is not showing properly(Bootstrap)

I am trying to create a navbar using bootstrap.But the home icon in navbar is not showing properly.It is not in middle and not in parallel with other list.Please help me to solve this.
Problem:
HTML:
<nav class="navbar navbar-inverse">
<div class="container">
<div class="row">
<nav class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li>
<a href="#" class="navbar-brand text-center">
<span class="glyphicon glyphicon-home"></span>
</a>
</li>
<li class="active">
<a href="#">Avro keyboard<br/>
<small>For windows</small>
</a>
</li>
<li>
<a href="#">iAvro<br/>
<small>For Mac OS X</small>
</a>
</li>
<li>
<a href="#">ibus-avro<br/>
<small>for linux</small>
</a>
</li>
<li>
<a href="#">Bangla Fonts<br/>
<small>Unicode/ANSI fonts</small>
</a>
</li>
<li>
<a href="#">Others<br/>
<small>Misc goodies</small>
</a>
</li>
<li>
<a href="#">Blog<br/>
<small>Stay updated!</small>
</a>
</li>
<li>
<a href="#">Help and support<br/>
<small>Forum & Help files</small>
</a>
</li>
<li>
<a href="#">Developers<br/>
<small>repositories and resources</small>
</a>
</li>
</ul>
</nav>
</div>
</div>
</nav>
CSS:
li {
border-left: 1px solid;
border-top: 0px;
border-right: 1px solid;
border-bottom: 0px;
border-style: solid;
border-color: #545454;
}
a {
color: #FFFFFF !important;
}
small {
color: #C5C6C1;
font-style: italic;
}
You can apply any changes to the CSS rule below:
.navbar-inverse .navbar-brand .glyphicon{
padding: 5px 0 0 15px;
}
.navbar {
border-radius: 0;
}
.navbar-inverse .navbar-header .navbar-brand {
color: #FFFFFF;
}
.navbar-inverse .navbar-nav > li:first-child {
border: none;
padding-top: 10px;
}
.navbar-inverse .navbar-nav {
border-left: 1px solid #545454;
}
.navbar-inverse .navbar-nav > li {
border: none;
border-left: 1px solid #545454;
border-right: 1px solid #545454;
}
.navbar-inverse ul.navbar-nav > li > a {
color: #FFFFFF;
}
small {
color: #C5C6C1;
font-style: italic;
}
#media (min-width: 1200px) {
.navbar .navbar-nav {
display: inline-block;
float: none;
vertical-align: top;
}
.navbar .navbar-collapse {
text-align: center;
}
.navbar-inverse .navbar-header a {
display: none;
}
}
#media (max-width: 1200px) {
.navbar-inverse .navbar-nav > li:first-child {
display: none;
}
.navbar-inverse .navbar-nav {
border: none;
}
.navbar-inverse .navbar-brand {
line-height: 0;
}
.navbar-inverse .navbar-nav > li {
border: none;
}
.navbar-inverse .navbar-header {
float: none;
}
.navbar-inverse .navbar-left,
.navbar-right {
float: none !important;
}
.navbar-inverse .navbar-toggle {
display: block;
}
.navbar-inverse .navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.navbar-inverse .navbar-collapse.collapse {
display: none !important;
}
.navbar-inverse .navbar-nav {
float: none !important;
margin-top: 7.5px;
}
.navbar-inverse .navbar-nav > li {
float: none;
}
.navbar-inverse .navbar-nav > li > a {
padding-top: 10px;
padding-bottom: 10px;
}
.navbar-inverse .collapse.in {
display: block !important;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<nav class="navbar navbar-inverse">
<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" 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="#"> <span class="glyphicon glyphicon-home"></span>
</a>
</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> <a href="#"><span class="glyphicon glyphicon-home"></span>
</a>
</li>
<li class="active"> <a href="#">Avro keyboard<br/>
<small>For windows</small>
</a>
</li>
<li> <a href="#">iAvro<br/>
<small>For Mac OS X</small>
</a>
</li>
<li> <a href="#">ibus-avro<br/>
<small>for linux</small>
</a>
</li>
<li> <a href="#">Bangla Fonts<br/>
<small>Unicode/ANSI fonts</small>
</a>
</li>
<li> <a href="#">Others<br/>
<small>Misc goodies</small>
</a>
</li>
<li> <a href="#">Blog<br/>
<small>Stay updated!</small>
</a>
</li>
<li> <a href="#">Help and support<br/>
<small>Forum & Help files</small>
</a>
</li>
<li> <a href="#">Developers<br/>
<small>repositories and resources</small>
</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>