我将 Pico CSS 安装到了我的 HTML 项目的 npm 工作区中。
npm i -D @picocss/pico
“@picocss/pico”:“^2.0.6”,
@use "../../node_modules/@picocss/pico/scss/index" with (
$enable-semantic-container: true,
$semantic-root-element: "#nffaac",
$enable-classes: true,
$modules: (
"themes/default": true,
"content/code": false,
"forms/input-color": false,
"forms/input-date": false,
"forms/input-file": false,
"forms/input-range": false,
"forms/input-search": false,
"components/accordion": false,
"components/card": false,
"components/dropdown": false,
"components/loading": false,
"components/modal": false,
"components/nav": false,
"components/progress": false,
"components/tooltip": true,
"utilities/accessibility": false,
"utilities/reduce-motion": false));
input, select, textarea {....}
#nffaac input, #nffaac select, #nffaac textarea {....}
为了将父元素应用到 Pico CSS _basics.scss 选择器上,我缺少什么?
以防万一有人遇到这个挑战并且只是想要一个围绕 pico 样式的父选择器,以下关于 条件样式 的资源帮助了我。
将该变量添加到我的 pico css 设置中现在会在 DOM 中显示我的父 ID。
// Pico lightweight version
@use "../../node_modules/@picocss/pico/scss/index" with (
$enable-semantic-container: true,
$semantic-root-element: "#nffaac",
$parent-selector: "#nffaac", //this is making all the difference
$enable-classes: true,
$modules: (
"themes/default": true,
"content/code": false,
"forms/input-color": false,
"forms/input-date": false,
"forms/input-file": false,
"forms/input-range": false,
"forms/input-search": false,
"components/accordion": false,
"components/card": false,
"components/dropdown": false,
"components/loading": false,
"components/modal": false,
"components/nav": false,
"components/progress": false,
"components/tooltip": true,
"utilities/accessibility": false,
"utilities/reduce-motion": false));
我现在看到以下内容已加载...
#nffaac input, #nffaac select, #nffaac textarea {....}