Reputation: 506
I've searched and searched, and I couldn't find a solution. I added an image into my navigation (my logo) and it is pushing the text down below the image, instead of displaying inline. How can I fix that?
Here is the css for the navigation:
header.container>.container--content>.container--navigation>li>a {
padding-left: 20px;
font-size: 13px;
text-transform: uppercase;
color: #1E7194;
transition: 0.25s;
}
Here is the HTML.
<header class="container">
<div class="container--content vertical center">
<div class="container--navigation">
<li><a id='1' href="#">Home</a></li>
<li><a href="#">About Me</a></li>
<img src="logo.png">
<li><a href="#">Contact Me</a></li>
<li><a href="#">Portfolio</a></li>
</div>
</div>
</header>
How can I get these two elements to display inline?
Upvotes: 0
Views: 412
Reputation: 425
There are a few ways of doing so. One solution:
header.container>.container--content>.container--navigation>li>* {
vertical-align: middle;
}
HTML:
<div class="container--navigation">
<li><a id="1" href="#">Home</a></li>
<li><a href="#">About Me</a></li>
<li><img src="http://dummyimage.com/90x90/000/fff"></li>
<li><a href="#">Contact Me</a></li>
<li><a href="#">Portfolio</a></li>
</div>
View Result Image
Upvotes: 1
Reputation: 78796
Wrap the image into <li>
:
<li><img src="logo.png"></li>
Remove this style from your CSS:
header.container {
height: 10%;
}
Then adjust the position of the logo if you need.
Upvotes: 1
Reputation: 9
you may set top with some appropriate negative value and position relative, but this may put some gap from bottom, see this quiz site testimonial section, it will appear something same.
Upvotes: 1