I'm making a website for my game coming up soon and it'll serve as a commercial piece (one-page website) for the game itself.
I am in the starting phase and is working on the navbar at the top (Yes I am using Bootstrap) but the font-awesome glyphs that I use don't seem to center up right compared to the text in the body:
As you see on the picture the Android and Apple icons are off-center compared to the text underneath. I get that it might be because of the icons I have on the right and left throwing it off center but I am fairly new to web development so I just request some help to fix that up :)
<div class="header">
<div class="well" style="height: 100%">
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
data-target=".navHeaderCollapse"
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>
<div class="collapse navbar-collapse navHeaderCollapse">
<ul class="nav navbar-nav navbar-left">
<li>
<a href="index.html">
<span><img alt="Dynamic Realities" width="42" height="42" src="img/Cogfire-notext.png"></span>
</a>
</li>
</ul>
<ul class="nav navbar-nav">
<li>
<a target="_blank" href="#">
<span class="fa fa-android" style="color: #5cb85c; font-size: 42px;"></span>
</a>
</li>
<li>
<a target="_blank" href="#">
<span class="fa fa-apple" style="color: #c0c0c0; font-size: 42px;"></span>
</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a target="_blank" href="http://www.twitter.com/DynRealities">
<span class="fa fa-twitter-square" style="color: #31b0d5; font-size: 42px;"></span>
</a>
</li>
<li>
<a target="_blank" href="http://www.facebook.com/DynamicRealities">
<span class="fa fa-facebook-square" style="color: #204d74; font-size: 42px;"></span>
</a>
</li>
<li>
<a target="_blank" href="http://www.youtube.com/DynamicRealities">
<span class="fa fa-youtube-square" style="color: #c12e2a; font-size: 42px;"></span>
</a>
</li>
<li>
<a target="_blank" href="#">
<span class="fa fa-tumblr-square" style="color: #204d74; font-size: 42px;"></span>
</a>
</li>
</ul>
</div>
</div>
</nav>
</div>
</div>
With the following CSS applied:
#media (min-width: 768px) {
.navbar .navbar-nav {
display: inline-block;
float: none;
vertical-align: top;
}
.navbar .navbar-collapse {
text-align: center;
}
}
Have a look at my fiddle, only added padding to make the logo center
http://fiddle.jshell.net/Jinukurian7/oqyvprxz/
Related
I'm using Bootstrap material design. Which is https://fezvrasta.github.io/bootstrap-material-design/
here is it's jsfiddle https://jsfiddle.net/Manoj07/4c90wbo3/
In this, I'm unable to make a navbar fixed on the top. I'm using a drawer navigation bar also in this so please help me out how to make navbar fixed top by using bootstrap material design? frezvasta.github.io
<header class="bmd-layout-header">
<div class="navbar navbar-light bg-faded">
<button class="navbar-toggler" type="button" data-toggle="drawer" data-target="#dw-s2">
<span class="sr-only">Toggle drawer</span>
<i class="material-icons">menu</i>
</button>
aabbaaaa
<a href="profile.html" style="text-decoration: none; color: black;"><i class="far fa-user-circle pl-1"
style="padding:0;"></i></a>
<a href="cart.html" style="color: inherit!important;"><i class="fas fa-shopping-cart pl-1"><sup><span
class="badge badge-info">0</span></sup></i></a>
</div>
</header>
<div id="dw-s2" class="bmd-layout-drawer bg-faded">
<header style="display: inline-block;">
<i class="fas fa-home"></i>Home
<a class="navbar-brand" href="index.html" style="padding-left: 50%;"><img src="img/logo.png" class="img-fluid"
style="height: 25px;width: 25px;"></a>
</header>
<ul class="list-group">
<li class="list-group-item">
<div class="dropright show">
<a class="dropdown-toggle text-dark" href="#" role="link" id="dropdownMenuLink" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
Categories
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<a class="dropdown-item" style="color: black;" href="fashion_category.html">Women</a>
<a class="dropdown-item" style="color: black;" href="fashion_category.html">Home Furniture</a>
<a class="dropdown-item" style="color: black;" href="fashion_category.html">TVs and Appliances</a>
<a class="dropdown-item" style="color: black;" href="fashion_category.html">Sports, Books & More</a>
<a class="dropdown-item" style="color: black;" href="fashion_category.html">Mobiles and Gadgets</a>
<a class="dropdown-item" style="color: black;" href="fashion_category.html">Men</a>
<a class="dropdown-item" style="color: black;" href="fashion_category.html">Pets</a>
<a class="dropdown-item" style="color: black;" href="fashion_category.html">Baby</a>
<a class="dropdown-item" style="color: black;" href="fashion_category.html">Cars & Bikes</a>
</div>
</div>
</li>
<li class="list-group-item">My Cart</li>
<a href="my_order.html" style="text-decoration: none; color: black;">
<li class="list-group-item">
My order
</li>
</a>
<a href="profile.html" style="text-decoration: none; color: black;">
<li class="list-group-item">My account</li>
</a>
<li class="list-group-item">Notifications</li>
<li class="list-group-item">Help center</li>
</ul>
</div>
<main class="bmd-layout-content">
<div class="search-container">
<input type="text" placeholder="Search aabbaaaa for products" name="search">
<button type="submit"><i class="fa fa-search"></i></button>
</div>
You mark up was all incorrect, Had fixed the markup and copule of css is updated.
You can add sticky-top class to make an element sticky to the top.
Please check the updated jsfiddle Here
Since the html is too long, I am not updating it here completely, justing posting the header part.
<header class="bmd-layout-header sticky-top">
<div class="navbar bg-light bg-faded">
<button class="navbar-toggler" type="button" data-toggle="drawer" data-target="#dw-s2">
<span class="sr-only">Toggle drawer</span>
<i class="material-icons">menu</i>
</button>
aabbaaaa
<a href="profile.html" style="text-decoration: none; color: black;"><i class="far fa-user-circle pl-1"
style="padding:0;"></i></a>
<a href="cart.html" style="color: inherit!important;"><i class="fas fa-shopping-cart pl-1"><sup><span
class="badge badge-info">0</span></sup></i></a>
</div>
</header>
put this css code
.bmd-layout-header .navbar{
position: fixed;
right: 0;
left: 0;
}
.bmd-layout-content {
padding-top: 56px;
}
OR
you can put material css .fixed-top class beside .navbar class and put this css so your layout not overlap to fix header
.bmd-layout-content {
padding-top: 56px;
}
have you add class like this in you html?
I created a drop down sub menu in bootstrap 3, in which the links are working (It goes to respective pages). But, While i shrink the browser to look as if like a mobile view, the links of the sub menus are not working(It goes to different page while the menu is clicked).
The following image depicts the issue with my issue.
From the above image, if i move the curser to click the 'tamil newsletter', it is moving to 'gallery' page.
I feel there is a simple solution for this issue and i do not know where i am wrong.
The following is my code:-
<nav id="navbar-section" class="navbar navbar-default navbar-static-top navbar-sticky" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div id="navbar-spy" class="collapse navbar-collapse navbar-responsive-collapse">
<ul class="nav navbar-nav pull-right">
<li>
About Us
</li>
<li>
Support Us
</li>
<li class="active dropdown">Newsletter
<ul class="nav navbar-nav pull-right dropdown-menu" role="menu">
<li>Tamil Newsletter</li>
<li>English Newsletter</li>
</ul>
</li>
<li>
<span>Gallery</span>
</li>
<li>
<span>Contact Us</span>
</li>
</ul>
</div>
</div>
</nav>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<nav id="navbar-section" class="navbar navbar-default navbar-static-top navbar-sticky" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div id="navbar-spy" class="collapse navbar-collapse navbar-responsive-collapse">
<ul class="nav navbar-nav pull-right">
<li>
About Us
</li>
<li>
Support Us
</li>
<li class="active dropdown">Newsletter
<ul class="nav navbar-nav pull-right dropdown-menu" role="menu">
<li>Tamil Newsletter</li>
<li>English Newsletter</li>
</ul>
</li>
<li>
<span>Gallery</span>
</li>
<li>
<span>Contact Us</span>
</li>
</ul>
</div>
</div>
</nav>
You are using bootstrap nav already... The pull-right which you added to dropdown-menu is creating the problem....
So as a quick patch, add this to you css.. add more specificity if there are other dropdown-menus on the page.
#media(max-width: 768px){
#navbar-spy > .navbar-nav{
border-left: 1px solid #ddd;
margin: 0 -15px;
width: 170px;
}
#navbar-spy .dropdown-menu.pull-right {
float: none !important;
}
#navbar-spy .dropdown-menu.navbar-nav{
margin:0;
font-size: 13px;
padding: 0;
}
#navbar-spy .navbar-nav .open .dropdown-menu.navbar-nav > li > a{
padding:2px 10px 2px 20px;
border-bottom: 1px solid #ddd;
}
}
I come to you because I'm pulling my hair out of my head on a design issue with bootstrap navbars.
I did a fixed top navbar with differents menu, one on the right and one on the left.
My CSS code turns the background of my links to the grey when the user hover them. But I notice that my menu items don't have the same height so when my pointer hover the smaller item, the new color doesn't fill the full height of the header bar.
This is some screenshots to help you :
And there is the code of my header bar :
<div class="container-fluid header-bar">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<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="index.html">Admin Page</a>
</div>
<!-- /.navbar-header -->
<ul class="nav navbar-nav navbar-left">
<li>
<a href class=" profile_image" >
<img src="../../../images/user.png" class="img-circle" alt="profile-pic"> {{vm.account.name}}
</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown" uib-dropdown="">
<a href class="dropdown-toggle lang_selector" uib-dropdown-toggle="">
<span class="flag-sm flag-sm-{{vm.defaultLang.flag}}"></span><span class="lang_desc">{{vm.defaultLang.text}}</span> <span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu" uib-dropdown-menu="">
<li ng-repeat="lang in vm.langs"><a href class="lang_selector" ng-click="vm.defaultLang = lang"><span class="flag-sm flag-sm-{{lang.flag}}"></span><span class="lang_desc">{{lang.text}}</span></a></li>
</ul>
</li>
<li>
<a href="" ng-click="vm.logout()">
<md-icon class="li-icon-black material-icons" aria-label="logout">exit_to_app</md-icon>
</a>
</li>
</ul>
</div>
And there is the CSS code :
.smsmode-nav .navbar-header {
width: 250px;
}
.lang_selector > span {
vertical-align: middle;
}
.lang_desc {
margin-left: 8px
}
.navbar-nav > li > a.profile_image {
padding-top: 10px;
padding-bottom: 10px;
}
.profile_image > img {
width: 30px;
}
I know there is a story of padding but I try everything and I can't fix it. I'm desperated ! So I need your help please !
hi remove this css i hope you got your solutions
.lang_selector > span {
vertical-align: middle;
}
My navbar seems to go out of whack. It's especially evident when I view the site on my mobile device, or just shrink my desktop window.
Below is a link to my site along with the code. I would love for my name to fit between my projects tap on the left and my e-mail and twitter icons on the right. Thank you for your help and time.
http://jocatcreative.com/
(trying to get past stack socials 2 link limit...
imugr dot com/0s4iJyr
imgur dot com/vqjiyEd)
(Edited to include screenshots)
<div class="navbar navbar-default">
<div class="container">
<div class="Heading Tag" align="center"><h2>Jovan S Hernandez</h2></div>
<button type="button" class="navbar-toggle" data-toggle="collapse"
data-target="#example-navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="example-navbar-collapse">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Projects <b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li>JoCat Creative Media</li>
<li>Gesaffelstein Landing</li>
<li>Monthly Resolutions</li>
<li class="divider"></li>
<li>Home</li>
<li class="divider"></li>
</ul>
</li>
</ul>
<ul class="pull-right">
<i class="fa fa-envelope-o"></i> Email Me
<i class="fa fa-twitter"></i> Twitter
</ul>
</div><!-- .container -->
</div><!-- .navbar -->
DEMO: https://jsbin.com/qufelu/1/
https://jsbin.com/qufelu/1/edit?html,css,output
You were using some incorrect classes, missing tags (on the right aligned stuff), unclosed tag (collapse), and were using an outdated attribute from ancient history ( align="center") Also, you don't need to wrap the name inside a div.
CSS
.custom-navbar {
background: transparent;
border: 0px;
}
#media (max-width:767px) {
.custom-navbar .name {
font-size: 20px;
float: left;
margin: 0;
padding: 15px 0 15px 15px;
}
.custom-navbar .navbar-toggle {
margin: 10px 15px 0 0;
float: right;
}
}
#media (min-width:768px) {
.custom-navbar .navbar-header {
width: 100%;
margin: 0;
}
.custom-navbar .name {
text-align: center;
float: none;
}
}
HTML:
<div class="navbar navbar-default custom-navbar">
<div class="container-fluid">
<div class="navbar-header">
<h2 class="name">Jovan S Hernandez</h2>
<button type="button" class="navbar-toggle" data-toggle="collapse"
data-target="#navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="navbar-collapse">
<ul class="navbar-right nav navbar-nav">
<li><i class="fa fa-envelope-o"></i> Email Me</li>
<li><i class="fa fa-twitter"></i> Twitter</li>
</ul>
<ul class="nav navbar-nav navbar-left">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Projects <b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li>JoCat Creative Media</li>
<li>Gesaffelstein Landing</li>
<li>Monthly Resolutions</li>
<li class="divider"></li>
<li>Home</li>
<li class="divider"></li>
</ul>
</li>
</ul>
</div>
<!-- .navbar-collapse -->
</div>
<!-- .container -->
</div>
<!-- .navbar -->
Im not sure is this an issue with the content below it, or nav-collapse itself, But the only way I can seem to replicate the issue in firefox is by changing float:left to float:none in the code below. Basically when I toggle the menu the content below it doesnt get pushed down in IE9
.navbar .navbar-inner .nav-collapse.collapse
{
background: #6E2E8F;
border-radius: 5px 5px 5px 5px;
float: left;
height: 0px;
margin-bottom: 15px;
padding: 0;
width: 100%;
}
.navbar {overflow: visible;}
Here is the outputted html...
<div class="navbar">
<div class="navbar-inner">
<a data-target=".nav-collapse" data-toggle="collapse" class="brand visible-phone"> Categories</a>
<a data-target=".nav-collapse" data-toggle="collapse" class="btn btn-navbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li>***CONTENT***</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<span>Start Shopping
</span><span class="active_downarrow"></span></a>
<span class="sub-menu-response">
<ul class="dropdown-menu" > ***CONTENT*** </ul>
<ul class="dropdown-menu" > ***CONTENT*** </ul>
<ul class="dropdown-menu" > ***CONTENT*** </ul>
<ul class="dropdown-menu" > ***CONTENT*** </ul>
<ul class="dropdown-menu" > ***CONTENT*** </ul>
</span>
</li>
<li> ***CONTENT*** </li>
<li> ***CONTENT*** </li>
<li>***CONTENT*** </li>
</ul>
</div>
</div>
</div>
Here is the link to the site... http://bc_mobile.hailstormcommerce.com/
You can try adding this css class:
.nav-collapse.collapse.in {
height: auto !important;
}
Because when you drop-down the navigation, bootstrap gives it an initial width fixed.