要添加自定义 CSS,您必须按照以下步骤操作:
Step1-确保将 Magento 应用程序设置为开发者模式。
Step2-将以下文件夹添加到您的自定义主题中
app / design / frontend / [vendor] / [theme] / Magento_Theme / layout
app / design / frontend / [vendor] / [theme] / web / css
创建以下文件:
app / design / frontend / [vendor] / [theme] / Magento_Theme / layout / default_head_blocks.xml
app / design / frontend / [vendor] / [theme] / web / css / local-m.css
app / design / frontend / [vendor] / [theme] / web / css / local-l.css
将此代码放入default_head_blocks.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../vendor/magento/framework/Module/etc/module.xsd">
<head>
<css src="css/local-m.css" />
<css src="css/local-l.css" media="screen and (min-width: 768px)"/>
</head>
</page>
Step3- 应用您的主题:http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/themes/theme-apply.html
Step4-部署静态资源(使用SSH):php bin/magento setup:static-content:deploy