Even using the body_class()
function that returns the page name or the id
of it when applying a certain rule to css
some elements in other pages change, for example:
Home:
<body <?= body_class(); ?>> <!-- retorna uma string "home" -->
<div class="hero">
<h1 class="title">Titulo</h1>
</div>
...
Contact page:
<body <?= body_class(); ?>> <!-- retorna uma string "page-id-5" -->
<div class="hero">
<h1 class="title">Titulo</h1>
</div>
...
When using css
I always try to use the first class that is in body
, ie:
.page-id-5 .hero .hero-body .title {
color: white;
}
But even so, this rule is being applied to the home
page, what is the best way to separate css's
between pages in wordpress
?