1

Hi am new to ultimo and recently am trying to add my own custom CSS in order

Pramod
  • 1,464
  • 1
  • 11
  • 38

2 Answers2

2

I think the code should be like this:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <css src="Learning_Module::css/custom-style.css" />
    </head>
    <body>

    </body>
</page>
Partab Saifuddin Zakir
  • 1,238
  • 1
  • 18
  • 43
0

I agree with @Partab, just want to add more details to the answer. The file has to be exactly app/design/frontend/Infortis/custom/Magento_Theme/layout/default_head_blocks.xml where Infortis - is the theme vendor name, custom - name of the child theme, Magento_Theme - is the folder where the default_head_block.xml has to be stored, otherwise, it won't work.

The content of the .xml has to be

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <css src="css/custom.css"/>
    </head>
</page>

Then you can add your own css rules to custom.css file. custome.css has to be stored at app/design/frontend/Infortis/custom/web/css/custom.css

Then you would delete the content of pub/static except the .htaccess file, then do the static deploy command

php bin/magento setup:static-content:deploy

Then flush and clean magento cache

php bin/magento cache:clean
php bin/magento cache:flush

Cleaning Magento cache is not necessary, but it will help sometimes.

in43sh
  • 117
  • 6