Site logo

Archived topic

Adding CSS to Header Element

8 replies · Started by Max on April 20, 2022

Viewing posts 1–9 of 9

Hello,
I need two different styled header navigation. One for front page and another for all other pages.
I created 2 different Elements (type header). But can not figure out how to add different styling for them (there no field to add css class).

So far I find out one of the methods to achieve this, is to use pseudo-classes:

body:not(.home) .main-navigation{
/*my styling here*/
}

Hi Sergly,

You can select specific Pages to include and exclude in the Display Rules of an Element.

If you’re adding specific CSS, you can indeed use pseudo classes.

Kindly let us know if further assistance is needed regarding this. :)

Yes, we can definitely do custom CSS using pseudo classes, but it's not very convenient (it's overloading the system, not kind of clean code like BEM methodology).
Just curious why do not add Element Classes Field for Header Element like other elements have, for example:

Thank you.

Good point. You may also just add a class there instead of using pseudo classes. :)

Fernando, no you can not. Actually, it's what this topic is about.

Element Header does not have this field:

Page Hero has, but we speaking about Header navigation.

Got it, Thank you, Fernando and David.

You're welcome

This archived topic is closed to new replies.