3

I am setting up a Joomla 3 site and want to use custom global CSS which is template independent. The reason why I need this is that the admin of the site will need to change the template in use. I am setting up a few CSS styles which will need to be retained irrespective of the template in use.

Can some one tell me how to do this.

PS: I am relatively new to Joomla, so, please keep it in mind.

1
  • How template are you use?
    – Max
    Commented Sep 10, 2015 at 23:45

2 Answers 2

2

For this, you can import a CSS file using a plugin which will inject the file into the <head> when it's being rendered.

I developed a small plugin some time ago which allows you to import as many custom CSS or JS files.

You can also find others on the Joomla Extensions Directory under the Coding & Scripts Integration category

-1

In protostar template:

  • Create file in /template/protostar/css/custom.css
  • Add in file /template/protostar/index.php after line ~44.

    $doc->addStyleSheet($this->baseurl . '/templates/' . $this->template . '/css/custom.css');
    
1
  • 1
    OP asked for a global CSS which is template independent. This solution would have to be implemented in each template :) In addition, component.php is a special file used to output the component part only (for print etc.), without any other content. In any case your code should be added to index.php.
    – johanpw
    Commented Sep 11, 2015 at 1:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.