问题
I am working in magento 2.0 and want to make changes in admin login panel. please suggest me how to override admin css files or how to add new css file.
Thanks
回答1:
you need to add a custom module and define css in desired xml or if you want to add in all pages create default.xml
1) add a module Ex. Emizentech/NewAdmin
2) create a new file view/adminhtml/layout/default.xml in the module
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<css src="css/emizentech.css"/>
</head>
</page>
3) Add .css file in web folder as below path:
view/adminhtml/web/css/emizentech.css
after this you need to clear cache and deploy static content
php bin/magento cache:clean
php bin/magento setup:static-content:deploy
回答2:
Better way to create child theme so when you update magento your change not remove.
You can create child theme as like created for frontend theme.
Backend this are vendor/magento/theme-adminhtml-backend
.
You can get reference for create child theme from vendor/magento/theme-frontend-luma
, because that this is child theme of Magento/blank
, you can check that from file vendor/magento/theme-frontend-luma/theme.xml
.
For more about create theme you can get reference form: http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/themes/theme-create.html
来源:https://stackoverflow.com/questions/37458644/magento-2-0-override-admin-css-style-css