Vertically Centered Header
-
I’ve been duking it out with chatGPT, trying to get my Site Title and navigation menu to appear on the same line in the header, both of them vertically centered. It provided me with some CSS, but I’m still running into issues. The site title looks a bit too high and isn’t perfectly vertically centered. Plus, when I hovered with Inspect, it looked like my Site Title is 2 sections. I think that’s ok now. Here’s the CSS I’m working with:
/* Header Container */
.site-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 20px;
min-height: 60px;
}
/* Company Name */
.site-branding {
display: flex;
align-items: center;
white-space: nowrap;
}
.site-branding .site-title {
margin: 0;
font-size: 1.8em;
line-height: 1;
}
/* Navigation Menu */
.main-navigation {
display: flex;
align-items: center;
}
.main-navigation ul {
display: flex;
gap: 20px;
list-style: none;
margin: 0;
padding: 0;
}
.main-navigation li a {
padding: 8px 10px;
display: inline-flex;
align-items: center;
}
/* Hide Search and Cart */
.site-search,
.site-header-cart {
display: none !important;
}
/* Outer header container / .col-full { display: flex; align-items: center; / Vertically center children */
justify-content: space-between;
padding: 10px 20px;
min-height: 60px;
}
/* Branding block / .site-branding { display: flex; align-items: center; / Vertically center site-title */
height: 100%;
}
/* Site title text / .site-title { margin: 0; font-size: 1.8em; line-height: 1.2; display: flex; align-items: center; / Vertically center text */
height: 100%;
}Issues:
- The site title is still too high and doesn’t seem vertically centered within the header.
- I’m not sure if something in the code is conflicting, but it’s just not quite right.
Can anyone point me in the right direction to fix this? Thank you.
The page I need help with: [log in to see the link]
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
The topic ‘Vertically Centered Header’ is closed to new replies.