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?