2

Edit: I need to move on for now, so I've temporarily added style="line-height:50px to the span element of the first li item (nav-item--home). If anyone sees the difference between the two sites, which makes the first <a> element ignore its line-height, please let me know.

I'm trying to implement the same styling from the top navigation bar on the site:

https://acrobotic.com

on the site:

http://learn.acrobotic.com

As you can see, the first element inside the <ul> doesn't align vertically with the rest. The element consists of:

<li class="nav-item nav-item--home level0 level-top active">
  <a class="level-top" href="http://learn.acrobotic.com/">
    <span class="ic ic-home"></span>
  </a>
</li>

By comparing the two I notice that the <span> element has the correct size (30x16). However, the <a> element containing it has an incorrect height of 16px (54x16) whereby it should be 50px. Its height should be set by the line-height property provided it's a block element.

For debugging purpose using the console in Developer Tools I check the CSS by:

jQuery('.ic-home').parent().css('display')
"block"

jQuery('.ic-home').parent().css('line-height')
"50px"

Both properties seem to be set correctly, however, as the title mentions the block element is ignoring the line-height property. If you can shine a light into this problem I'd be grateful as it's been a couple of days of banging my head against this wall.

user2636834
  • 71
  • 2
  • 10
  • No, I'm using JavaScript to debug the CSS. I'll clarify it on the post. – user2636834 Nov 07 '16 at 19:12
  • An inline element (like an `a` tag) should not contain a block element (even a `span` tag marked as `display: block`), which might explain the weird behavior. Try putting the line-height on the `li`? – Erty Seidohl Nov 07 '16 at 19:18
  • More info: https://stackoverflow.com/questions/1714121/block-level-elements-inside-inline-elements – Erty Seidohl Nov 07 '16 at 19:19
  • @ErtySeidohl That doesn't really explain why the https://acrobotic.com/ works, they have the exact same code (as far as I can tell) besides the fonts. Also adding the line-height doesn't work. – HarrisJT Nov 07 '16 at 19:37
  • Ever figure this out? Having a similar problem. – BooBailey Nov 03 '17 at 00:26

1 Answers1

0

I see in css by development tools this: .menu-trigger, .nav-regular .nav-item.level0 > a and in the "a" tag of the icon is set to 50px instead in the others "li a" tag is set to 20px. if you change it it clears.

lisarko8077
  • 299
  • 5
  • 23