0

JSFiddle link: https://jsfiddle.net/jm5b5p9L/1/

CSS:

header {
    background-color: #323d51;
    height: 600px;
}
li {
    display: inline-block;
    border: 5px solid mistyrose;
    height: 100px;
    width: 100px;
}
.logo {
    background-color: grey;
    height: 100px;
    width: 100px;
}
.userlink {
    color: white;
    border: 2px solid goldenrod;
}

So, I am having trouble understanding why on the first "row", so to speak, my two li inline-blocks are not aligned with one another, but in the bottom two rows, there is no issue. It seems like it is because the child elements are different, but I don't know why that would matter.

Can anyone explain why this is happening and what I can do to resolve it?

user4853
  • 363
  • 3
  • 8
  • 1
    It is because `inline-block` and the font: http://stackoverflow.com/questions/20106428/why-does-inline-block-cause-this-div-to-have-height/20107222#20107222 (NOTE: also `

    ` has a default margin + `.username` has a border, both make the `

  • ` bigger)
  • – nkmol Jan 11 '16 at 19:47
  • 3
    See: [CSS Inline-Block Elements Not Lining Up Properly](http://stackoverflow.com/questions/19366401/css-inline-block-elements-not-lining-up-properly).. if you add `vertical-align: top` to the inline elements, it will work as expected - https://jsfiddle.net/3va36efr/ – Josh Crozier Jan 11 '16 at 19:49