I'm trying to add the Twitter logo to my header (I use Bootstrap CSS), but it twists the alignment. I tried to put them side by side, but instead he pushed them. Here is my first attempt:
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <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 csh-top-link" href="index.html">Cardshifter</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><img src="images/logos/Twitter_logo_blue.png" style="height: 1.5%; width: 1.5%;"><a href="https://twitter.com/Cardshifter" class="navbar-brand csh-top-link" style="font-size: 1.2em; margin-top: 2px;">@Cardshifter</a></li> </ul> </div> </nav>
Here's what it looks like:

This was my second attempt using <div> instead of <ul> :
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <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 csh-top-link" href="index.html">Cardshifter</a> </div> <div id="navbar" class="collapse navbar-collapse"> <div class="nav navbar-nav"> <img src="images/logos/Twitter_logo_blue.png" style="height: 1.5%; width: 1.5%;"> </div> <div> <a href="https://twitter.com/Cardshifter" class="navbar-brand csh-top-link" style="font-size: 1.2em; margin-top: 2px;">@Cardshifter</a></li> </div> </div> </nav>
This seems like a slight improvement, as they have separate elements (note that the blue outline on the right only appears in my preview in brackets, and not in real execution):

I looked at CSS margin and padding in versions of <ul> and <div> with no visible improvements. If you want to see the code in context, it is currently hosted on Github until a solution is found. Desired layout side by side:
[Cardshifter] | [Twitter logo] | [@Cardshifter]
source share