I have been looking at several threads on SO and on google that says that i could use line-height after setting the height of the div to make the text align vertically. This however requires that you set the height of the div which cant be good for a responsive web design ? I'm trying to align a single line of text in a navigation bar.
Some sample code:
<nav>
<section class="logo">
<span>logo text</span>
</section>
<section>
<ul>
<li>link</li>
<li>link</li>
<li>link</li>
<li>link</li>
</ul>
</section>
<section class="dropdown">
<span>dropdown</span>
</section>
</nav>
.logo {
display: inline-block;
}
.dropdown {
display: inline-block
}
I need to align the logo and dropdown text inside the span elements, but i dont have any height set anywhere because I want the design to adapt to the screen resolution more easily.
The span is inside a nav element so i thought i could do "height: 100%" on the span if i set it to an inline-block element but that did not work.
Is there any way to get line-height to work with height without manually specifying the height for the span in pixels so i can get a vertically aligned text which is as responsive as possible ?
I have been looking at using the vertical-align property with css tables as well, but it looks like i also in that case have to specify the height of the container element in pixels.