One way POCSS (Plain Ol 'CSS):
In your main.twig file
<body class="{% block body_class 'home' %}"> <ul class="nav nav-list"> <li class="nav-home"> <a href="/">Link</a>Home</li> <li class="nav-about"> <a href="/about">About Us</a> </li> <li class="nav-contact"> <a href="/contact">Contact Us</a> </li> </ul>
In the template about_page.twig
{% block body_class 'page-about' %}
In your CSS file
.page-about .nav-about, .page-home .nav-home, .page-contact .nav-contact { }
The advantage of this is that you can set other things on your pages according to the setting of the body class, for example:
.page-about a { h1: green; } .page-home a { h1: blue; } .page-contact a { h1 : pink; }
source share