How to add custom css style to a template Topic is solved

Everything to do with Joomla! 3.x templates and templating.
Post Reply
vasmed
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Mon Aug 24, 2020 8:39 am

How to add custom css style to a template

Post by vasmed » Thu Aug 27, 2020 4:11 am

Be healthy and joy everybody!
Forgive me if my question would make you confuse for any reason.
I need to change css style of some element in template page.
I know, that there is this ways for that:
1) Use style="property:value" in editor (inline styles)
2) Edit index.php and add additional css file.
3) Use special plugin.
But those ways have their disadvantages.
1) repeating code for several pages
2) loss of changes during an update
3) need for additional actions
Could anyone tell my why there is no "custom.css" in "templates/protostar/css" directory, which will never change during updates, only by user with editing rights. And change index.php to add it by default .
I realize that if you add it now, existing file can be overwritten or it can be overwritten on next update. But maybe there is some ways to exclude this file from update procedure and create it if it isn't exists.
Or change index.php so that it would add it only if it exist (and maybe make button in administrator interface to create it if needed).

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 13133
Joined: Thu Feb 15, 2007 5:48 am
Location: Zagreb, Croatia

Re: How to add custom css style to a template

Post by toivo » Thu Aug 27, 2020 4:46 am

Welcome to the forum!

vasmed wrote:
Thu Aug 27, 2020 4:11 am
Could anyone tell my why there is no "custom.css" in "templates/protostar/css" directory, which will never change during updates, only by user with editing rights.
The reason is that Protostar expects custom CSS coding to be in the file user.css in the same location:
Adding a custom CSS with Protostar
Toivo Talikka, Global Moderator

vasmed
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Mon Aug 24, 2020 8:39 am

Re: How to add custom css style to a template

Post by vasmed » Thu Aug 27, 2020 6:53 am

Thank you, Toivo! I tried your advice and now i can see that indeed "user.css" is working and have been included in "index.php" already. Sorry for my slowness. I did't guess to look 40 strings below and here there is "check for a custom CSS file". That is what i was looking for, but can't find in my native forums. And i couldn't find time to read documentation.

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 13133
Joined: Thu Feb 15, 2007 5:48 am
Location: Zagreb, Croatia

Re: How to add custom css style to a template

Post by toivo » Thu Aug 27, 2020 8:38 am

Cheers, and no problems, we are all learning new things here.
Toivo Talikka, Global Moderator


Post Reply

Return to “Templates for Joomla! 3.x”