Some years ago, the question of how to load CSS in a way that permits a template override was answered here with:

 JHtml::_('stylesheet', 'mod_module/style.css', ['relative' => true]);

Recently, I found it seemed not to work with Joomla 3.10.11 but the following did:

 use Joomla\CMS\HTML\HTMLHelper;
 HTMLHelper::_('stylesheet', 'component/com_component/component.css', ['relative' => true], false);

However, it did not work in Joomla 4, no CSS was loaded. What is the code to use for Joomla 4? Is there code that will work in both 3.10.x and Joomla 4.x?

  • Could you update your question with the path of your extension CSS file and the template override path?
    – Lodder
    Sep 2, 2022 at 7:25
  • Sorry, I don’t know the template override path. The problem I have is that the CSS doesn’t get loaded at all. The path to CSS was your example, but I am working with a component so have amended my example.
    – mbrampton
    Sep 2, 2022 at 10:18

1 Answer 1


Joomla 4 implements the concept of Web Assets Manager, with which you need to include and use various assets - js and css.

Your Answer

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

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