2

I have css file design/theme/web/style.css but it is not working or maybe the thing i am adding is not responding . i have tried my own css in header of the theme it is working there but i know it is not a recommended way . how can i make my css run . setup:upgrade , static-content:deploy , cache:flush everything is done . but still not working .

  • How did you added your css to your theme and what is the exact location? – Sukumar Gorai Sep 18 '18 at 14:42
  • app/design/frontend/Alothemes/digitalworld1/web/css , i am using a theme i am just adding my own lines of css in this file and it is not working . – Flutterer Sep 18 '18 at 14:44
  • How did you call it in your theme? – Sukumar Gorai Sep 18 '18 at 14:45
  • I dont know the css was already in the theme , i am just trying to add my own lines in this css . – Flutterer Sep 18 '18 at 14:46
  • Does this css is calling in your theme or not? If not then you need to call it in your layout file. – Sukumar Gorai Sep 18 '18 at 14:47
0

if custom styling is not working there could be several reason, i.e file name, in which folder file has been placed, file permission is it included in Mgento_Theme/web/css or vendor/theme/web/css.

As per question make sure your file should be less file not css file and path you add in your default_head_blocks.xml should be css ( not less ) :

i.e if i want to add mycustom.css file in theme then how it should be :

<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/>
    <css src="css/mycustom.css" />
</head>

And file path should be and name should be mycustom.less:

vendor/themename/web/css/mycustom.less

After making changes running following commands :

in Linx :

magento-root$ rm -rf pub/static/frontend var/view-processed

magento-root$ php bin/magento setup:static-content:deploy

magento-root$ php bin/magento cache:flush

magento-root$ chown -R www-data:www-data ./*

in windows ( delete folders pub/static/frontend var/view-processed )

magento-root$ php bin/magento setup:static-content:deploy

magento-root$ php bin/magento cache:flush

Hope this will help and will work for you.

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.