directory structure.

app / design / frontend / Kidzie / theme / Magento_Theme / layout /default_head_blocks.xml app / design / frontend / [vendor] / [theme] / web / css /custom.css

I need to load custom.css file at last of all css files. so my custom style should apply over default magento 2's css.

enter image description here

<css src="css/custom.css" order="100"/> Gives me error that order is not a valid property.


Magento2 doesn't manage the CSS order, order="" property doesn't exists,

The available CSS attributes are:

  • defer
  • ie_condition
  • charset
  • hreflang
  • media
  • rel
  • rev
  • sizes
  • src
  • src_type
  • target
  • type

I have some workaround to put the css at the end of all. the trick is to add media="all".

<css src="css/custom.css" media="all" />

Please first study, this Load Custom CSS After style-l.css For Home Page article. Here Rajeev K Tomy explain the load sequence of CSS at Magento2.

As you want to call your css at last, So you have done some changes at


<css src="Magento_Theme::css/custom.css" media="all" />

It means to you have to change your css file location to

app / design / frontend / [vendor] / [theme] /Magento_Theme/ web / css /custom.css

Then you have to do cache flush and static content deploy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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