0

In magento 1, I have used addCss function to add css file to head.

However, I don't see this function in magento 2. Can you help me?

1
  • Are you trying to add the the head of all pages? Commented Jan 2, 2016 at 21:28

1 Answer 1

1

Magento 2 has a quite different approach to CSS, where the Less pre-processor is an important part the play.

In layouts there you can add have a <css> element in <head>, so you do it via configuration rather than PHP code.

But there is also the whole Less infrastructure where maybe you want to use the _extend.less file to merge your CSS into the main CSS file generated rather than forcing the web browser to download an additional page. So I would suggest you also read up on Less support in Magento.

See also How to add new css file for a module in Magento2?

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