闲社服务运行正常AI智能体自动化平台
t

极简CSS

技能标识:tiny-css

Write minimal, efficient CSS for small or minimalist projects by trusting the browser instead of fighting it. Only use this skill for personal sites, prototypes, simple landing pages, or projects intentionally kept lean — if the project has multiple developers, a component library, a design token system, or more than a handful of CSS files, use more-css instead. If you're about to write a CSS reset, declare a base font-size on :root, set default colors on body, use px for spacing, or reach for p

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 1.0.0
检测标记
后台标记通过
免费
免费获取
0
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

极简CSS

极小化CSS

适用于小型、极简项目——个人网站、原型、简单的落地页。尽可能少写CSS,让浏览器处理其余部分。如果项目规模超过几个文件,或需要令牌系统或命名约定,请改用more-css。

核心原则

  1. 1. 信任浏览器 — 不要重置已经正常工作的内容
  2. 使用现代特性 — 让CSS处理原本由JavaScript完成的工作
  3. 尊重用户偏好 — 遵循系统对动画、对比度和配色方案的设置
  4. 编写弹性样式 — 使用逻辑属性以支持国际化

指南

不要声明基础字号

让浏览器处理基础字号,默认为100%(通常为16px)。用户可以在浏览器设置中调整此值以提升可访问性。

css
/ 不要这样做 /
:root {
font-size: 16px;
}
html {
font-size: 100%;
}
body {
font-size: 1rem;
}

/ 什么都不做 — 浏览器已处理 /

使用字形更优的系统字体

在San Francisco字体中启用大写I、小写l和带斜线零的区分字符。

css
:root {
font-family: system-ui;
font-feature-settings: ss06;
}

改善文本换行

防止孤行并改善断行效果。

css
:where(h1, h2, h3, h4, h5, h6) {
text-wrap: balance;
}

:where(p) {
text-wrap: pretty;
}

不要声明默认颜色

不要在根元素上声明颜色和背景色。浏览器默认值即可正常工作并尊重用户偏好。

css
/ 不要这样做 /
body {
color: #000;
background-color: #fff;
}

/ 什么都不做 — 浏览器默认值即可 /

启用亮色和暗色模式

使用color-scheme根据用户系统偏好自动支持亮色和暗色模式。

css
:root {
color-scheme: light dark;
}

自定义交互元素颜色

使用accent-color更改复选框、单选按钮、范围滑块和进度条的颜色。

css
:root {
accent-color: #0066cc; / 替换为所需颜色 /
}

使SVG图标与文本颜色匹配

让SVG图标自动继承当前文本颜色。

css
:where(svg) {
fill: currentColor;
}

使用逻辑属性

编写适用于所有语言和书写方向的CSS。使用逻辑属性替代物理属性。

css
/ 不要这样做 /
.card {
margin-left: 1rem;
margin-right: 1rem;
padding-top: 2rem;
padding-bottom: 2rem;
width: 20rem;
min-height: 20rem;
}

/ 这样做 /
.card {
margin-inline: 1rem;
padding-block: 2rem;
inline-size: 20rem;
min-block-size: 20rem;
}

使媒体嵌入自适应

确保图片、视频和iframe按比例缩放。

css
:where(img, svg, video, iframe) {
max-inline-size: 100%;
block-size: auto;
}

为交互元素添加指针光标

为所有可点击元素提供基础的悬停提示。

css
:where(input:is([type=checkbox], [type=radio]), select, label, button) {
cursor: pointer;
}

支持强制颜色模式

通过添加显式边框,确保按钮在Windows高对比度模式下保持可见。

css
@media (forced-colors: active) {
:where(button) {
border: 1px solid;
}
}

条件启用平滑滚动

仅在用户未请求减少动画时应用平滑滚动。

css
@media (prefers-reduced-motion: no-preference) {
:root {
scroll-behavior: smooth;
}
}



最小基础样式表

以下是包含所有指南的完整最小基础样式表:

css
:root {
color-scheme: light dark;
accent-color: #0066cc;
font-family: system-ui;
font-feature-settings: ss06;
}

:where(h1, h2, h3, h4, h5, h6) {
text-wrap: balance;
}

:where(p) {
text-wrap: pretty;
}

:where(img, svg, video, iframe) {
max-inline-size: 100%;
block-size: auto;
}

:where(svg) {
fill: currentColor;
}

:where(input:is([type=checkbox], [type=radio]), select, label, button) {
cursor: pointer;
}

@media (forced-colors: active) {
:where(button) {
border: 1px solid;
}
}

@media (prefers-reduced-motion: no-preference) {
:root {
scroll-behavior: smooth;
}
}

标签

skill ai

通过对话安装

以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 tiny-css-1776082681 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 tiny-css-1776082681 技能

通过命令行安装

skillhub install tiny-css-1776082681

下载

⬇ 下载 tiny-css v1.0.0(免费)

文件大小: 4.06 KB | 发布时间: 2026-4-17 16:21

v1.0.0 最新 2026-4-17 16:21
- Initial release introducing the tiny-css skill for minimalist CSS design.
- Emphasizes browser defaults: no resets, font-size overrides, or default colors.
- Guides use of logical properties, system fonts, and CSS modern features.
- Includes recommendations for accessibility, internationalization, and user preferences.
- Provides a minimal base stylesheet incorporating all core principles.
返回顶部