Controller Action Specific CSS

I thought this would be an easy adjustment but apparently I am doing something wrong.

I am just attempting to override the CSS on my homepage (site/index) so that it does not have a background color. I have a stylesheet that works for this, and if I register it from the action and manually delete the main.css call from the main.php layout file it renders 100% correctly. The second I put the main.css back in the main.php it overrides the controller action specific css and adds the homepage background color back in.

What is the proper way to override css in Yii? I have read everything google would give me and nothing is working.



Create a new selector class that overrides the properties you don’t want/want on your home page. Then, in your layout file, if the page being rendered is your home page, add the selector class to the elements in question.

Can be used on any page with multiple classes even. Make CSS your bitch and you will code a whole lot less. :wink:

You even don’t need to delete css inclusion from layout file.

Just override css property you want to , in new css file, that you would include it in your action function. In new css file, you can use use ‘important’ keyword, but in most case you will not have, because the latest value override the previous one.