I am trying to create the following design
Where the left side is an image followed by a tag with words.
on the right are the menu options which should look like they are clickable. The slashes that separate them should never move change color etc. However "About" "Contact" and "The Future" will eventually look different when hovered over and will take you to different pages on the site.
So when I attempted to create this I made the following HTML and CSS (make sure the window is wide when you run it)
.modernShadow {
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
}
.fittingObject {
max-width: 100%;
max-height: 100%;
}
#topdiv {
position: fixed;
z-index: 2;
background-color: #4FBEA9;
width: 100%;
height: 44pt;
padding-top: 3pt;
padding-bottom: 3pt;
padding-left: 3pt;
padding-right: 3pt;
}
#topdiv * {
display: inline;
vertical-align: middle;
}
.title {}
.titleLogo {}
.titleHere {
color: white;
}
.rightList {
float:right;
vertical-align: middle;
}
<header>
<!-- Displays in tab bar -->
<title>Logo Here</title>
<div id="topdiv" class="modernShadow">
<img src="https://cdn1.iconfinder.com/data/icons/computer-system-files-essential-glyph/48/Sed-40-512.png" class="fittingObject" />
<h1 class="title">
<h1 class="titleLogo">Logo</h1>
<h1 class="titleHere">Here</h1>
</h1>
<nav class="rightList">
<ul>About</ul>
/
<ul>Contact</ul>
/
<ul>The Future</ul>
</nav>
</div>
</header>
And the result is this
And I can't explain why because I don't understand what is happening to make it this way.
- Why are components under float:right not vertically aligned like everything else? I believe
#topdiv *
gives every subcomponent the stylevertical-align: center
so why isn't that coming into play? - Where is the spacing between the words and the "/"s coming from?
- I am not sure it isn't just a fluke that "Logo Here" is appearing vertically centered... Maybe that is just the font size? But that is set by the .fittingObject css. (the title logo should be as big as it can be)
The end goal is essentially the picture above. The font size of the right items is variable and the text should just always be vertically centered inside of the containing div.