Navbar Logo and brand link overlapping if they both get same class
See original GitHub issue <a href="#!" class="brand-logo left">LOGO</a>
<ul class="left hide-on-med-and-down">
when give same direction class they overlap, better to be on the right or left of logo based on direction
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:10 (1 by maintainers)
Top Results From Across the Web
Bootstrap navbar-brand logo overlapping on collapse
By default, when I added my logo wrapped with the navbar-brand class as in their documentation example, the logo overhangs off the navbar....
Read more >How to Create, Edit, & Make Your Navbar Awesome in Bootstrap
Learn how to create an awesome navigation bar for your Bootstrap site so you can help visitors browse your site faster and easier....
Read more >Navbar - React-Bootstrap
A powerful, responsive navigation header, the navbar. Includes support for branding, navigation, and more. Overview#. Here's what you need to know before ...
Read more >Bootstrap Navbar - examples & tutorial
A basic example of the navbar with the most common elements like link, search form, brand, and dropdown. All of them are explained...
Read more >Navbar - Bootstrap
Here's what you need to know before getting started with the navbar: ... As a link --> <nav class="navbar navbar-light bg-light"> <a class="navbar-brand" ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This question is a little complex.
It’s important to understand that
.brand-logo
usesposition:absolute
- which means it gets taken out of the flow of the page. The ul links do not see it, so that is why they overlap. To them, it is not even there.The best solution here is not to be adding inline margins - these values could change in future, if the font changes, or the letter spacing, or the site name - and then the spacing will be out.
Removing position:absolute from .nav-logo is one solution, and using floats on on the logo and the ul:
https://codepen.io/doughballs/pen/gOayyyV
we put the logo back into the flow of the page, and then float both left.
It gets even more complex here. ul; by default is a block level element. If we take the float off, then it sits under the logo, under the nav! If we change to
display:inline
, it moves back up into the nav, but before the brand logo!.left
is a utility class - a simple helper to float something left or right. It is sometimes better not to use utility classes, and write css that takes complete control of the component. it is not great in this example to have multiple left classes. (We can achieve the same thing with css with fewer classes)