Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
Hello, I’m not sure what you mean by the li and a elements. Can you clarify? When I looked at your site just now I didn’t see the issue.
Thread Starter
hartv
(@hartv)
Sure. I basically wanted to change all first-letter-colors of the whole navigation menue on top using the custom CSS option. The html of the navigation looks something like this:
<nav id="site-navigation" class="main-navigation" aria-label="Top Menu">
<div class="menu-primary-en-container">
<ul ... class="main-menu">
<li ... class="menu-item ..."><a href=...>Main 1</a></li>
<li ... class="menu-item ..."><a href=...>Main 2</a></li>
<li ... class="menu-item ..."><a href=... ...>Submenue</a> <button ...>
<ul class="sub-menu">
<li ... ><button...></li>
<li ... class="menu-item ..."><a href=...>Sub 1</a></li>
<li ... class="menu-item ..."><a href=...>Sub 2</a></li>
<li ... class="menu-item ..."><a href=...>Sub 3</a></li>
</ul>
So I tried to change the first-letter colors of those elements with CSS. If I use something like
.menu-item li:first-letter {
color: #ea4023;
}
It only affects the text Submenue and Sub 1, Sub 2, Sub 3 but not Main 1 and Main 2. I also tried various other classes like .main-menu but results are always the same. It is easy to modify this on previous, official wordpress themes but this time I’m stuck.
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
It’s something to do with the list item being an inline element. Try using flex:
@media screen and (min-width: 768px) {
.main-navigation .main-menu {
display: flex;
}
}
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
I see you’re no longer using Twenty Nineteen so I’ll mark this resolved
Thread Starter
hartv
(@hartv)
Yes, I’m still experimenting a bit.
Your solution works by the way. Thank you a lot for your help.