Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

How to style the navigation only on one page

Started by Joseffa Steuernagel 7 years ago · 0 replies · 592 views
7 years ago

Hey, I'm completely new to Grav. I'm in the process of styling a page and would like to have the navigation bar on the home page styled differently than on all the other pages. But I don't understand how I can "grab" it alone. To style the background of the home page I used the following code in the base.html.twig:

<body class="{{ page.header.body_classes }}{% if page.home %} home{% endif %}"{% if page.home %} style="background-image: url('{{theme_url}}/assets/my-picture.jpg' );"{% endif %}>

and then wrote this in the CSS:

CSS
.home {
   background: no-repeat cover center;
}

That works perfectly fine to only style the background of the home-page.
Is there a similar syntax to only style the navigation area? I use the Hyde theme in combination with my own CSS.

Suggested topics

Topic Participants Replies Views Activity
Themes & Styling · by FrViPofm, 4 weeks ago
4 473 2 weeks ago
Themes & Styling · by johan thomas, 5 years ago
1 800 3 weeks ago
Themes & Styling · by stuart young, 2 months ago
3 659 2 months ago
Themes & Styling · by Sebadamus, 3 months ago
5 679 2 months ago
Themes & Styling · by martynfoster735, 3 months ago
1 642 3 months ago