css - Centering brand logo in Bootstrap 3 Navbar -
I am trying to implement a Bootstrap 3 navbar so that the brand logo is always in the middle This code is:
& lt; Div class = "navbar navbar-fixed-top navbar-default" & gt; & Lt; Div class = "navbar-inner" & gt; & Lt; Div class = "container" & gt; & Lt; Button type = "button" style = "float: left;" Class = "pull-left BTN BTN-navbar navbar-toggle" data-toggle = "collapse" data-target = ". Nav-fall" & gt; & Lt; Span class = "icon-bar" & gt; & Lt; / Span & gt; & Lt; Span class = "icon-bar" & gt; & Lt; / Span & gt; & Lt; Span class = "icon-bar" & gt; & Lt; / Span & gt; & Lt; / Button & gt; & Lt; One class = "brand" style = "margin: 0; float: none;" Href = "#" & gt; & Lt; Img src = "/ content / themes / next / images / logo .png" /> & Lt; / A & gt; & Lt; Div class = "new-fall" & gt; & Lt; Ul class = "nav" & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; Item 1 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; Item 1 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; Item 1 & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Div & gt; & Lt; Ul class = "nav pull-right" & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; & Lt; Div class = "next cog" & gt; & Lt; / Div & gt; & Lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; Span class = "navbar-text pull-write" & gt; Superpup1 & lt; / Span & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; This creates a good looking navbar:
However, I would like the logo (green) to remain constant in the middle. I "br <=" # "& gt; & lt; img src =" / content / themes / next / images / logo .png "/>
This partially resolves this problem: The logo is in the middle but it pushes the rest of the rest of the nine elements:
Is this an undesirable effect that I would like to end? Can you recommend a solution? Maybe it's a logo from the beginning Wrong way to focus on
Try this:
.navbar {status: relative ;} Brand {Status: Absolute; left: 50%; margin-left: -50px! Important; / * 50% of your logo width * / display: block;}
Comments
Post a Comment