How to use CSS rules only on Page Course Index with SCSS?

How to use CSS rules only on Page Course Index with SCSS?

by Emi Ser -
Number of replies: 4
Hi!


It's possible to use specific CSS rules only on the page course index?
I try with this, but didnt work:

@if @"body id" == "page-course-index-category"{

//My CSS rules

}


Any help is welcome!

Average of ratings: -
In reply to Emi Ser

Re: How to use CSS rules only on Page Course Index with SCSS?

by Trevor Furtado -
Picture of Plugin developers

Any reason for simple selector by ID not be enough?


#page-course-index-category {

  //My CSS rules

}



In reply to Trevor Furtado

Re: How to use CSS rules only on Page Course Index with SCSS?

by Emi Ser -

Yes, i really want to change the way the courses are shown, but only on this page:

www.mywebsite.org/course/index.php

And since there are elements on the frontpage that are called the same way, my CSS's rules works on both pages, but I just want them to do it on the course index and not on the frontpage.


Thanks


In reply to Emi Ser

Re: How to use CSS rules only on Page Course Index with SCSS?

by Jean-Roch Meurisse -
Picture of Core developers Picture of Plugin developers Picture of Testers

You just have to prefix all your css rules with what Trevor said (#page-course-index-category) if you use plain css or place all your rules under that selector if you use scss.

#page-course-index-category {
    h3.coursename a {
        color: #F98012;
    }
}

Hope it helps

In reply to Jean-Roch Meurisse

Re: How to use CSS rules only on Page Course Index with SCSS?

by Emi Ser -
I don't know why but i remember that this was one this is one of the things i tried yesterday and didn't worked.
But magically today it works perfectly, thank you very much Trevor and Jean-Roch for your help.