← 返回
未分类 中文

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, prototy...
为小型或极简项目编写简洁高效的 CSS,信任浏览器而非对抗它。仅将此技能用于个人网站和原型。
mikemai2awesome
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 576
下载
💾 3
安装
1
版本
#latest

概述

Tiny CSS

For small, minimalist projects — personal sites, prototypes, simple landing pages. Write as little CSS as possible and let the browser do the rest. If the project is growing beyond a handful of files or needs a token system or naming conventions, use more-css instead.

Core Principles

  1. Trust the browser — Don't reset what already works
  2. Use modern features — Let CSS handle what JavaScript used to do
  3. Respect user preferences — Honor system settings for motion, contrast, and color schemes
  4. Write resilient styles — Use logical properties for internationalization

Guidelines

Don't Declare Base Font Size

Let the browser handle the base font size, which defaults to 100% (typically 16px). Users can adjust this in their browser settings for accessibility.

/* Don't do this */
:root {
  font-size: 16px;
}
html {
  font-size: 100%;
}
body {
  font-size: 1rem;
}

/* Do nothing — the browser already handles this */

Use System Font with Better Glyphs

Enable distinct characters for uppercase I, lowercase l, and slashed zero in San Francisco font.

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

Improve Text Wrapping

Prevent widows and improve line breaks.

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

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

Don't Declare Default Colors

Skip declaring color and background-color on the root. Browser defaults work and respect user preferences.

/* Don't do this */
body {
  color: #000;
  background-color: #fff;
}

/* Do nothing — browser defaults are fine */

Enable Light and Dark Modes

Use color-scheme to automatically support light and dark modes based on user system preferences.

:root {
  color-scheme: light dark;
}

Customize Interactive Element Colors

Use accent-color to change the color of checkboxes, radio buttons, range sliders, and progress bars.

:root {
  accent-color: #0066cc; /* Replace with desired color */
}

Match SVG Icons with Text Color

Make SVG icons inherit the current text color automatically.

:where(svg) {
  fill: currentColor;
}

Use Logical Properties

Write CSS that works across all languages and writing directions. Use logical properties instead of physical ones.

/* Don't do this */
.card {
  margin-left: 1rem;
  margin-right: 1rem;
  padding-top: 2rem;
  padding-bottom: 2rem;
  width: 20rem;
  min-height: 20rem;
}

/* Do this */
.card {
  margin-inline: 1rem;
  padding-block: 2rem;
  inline-size: 20rem;
  min-block-size: 20rem;
}

Make Media Embeds Responsive

Ensure images, videos, and iframes scale proportionally.

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

Add Pointer Cursors to Interactive Elements

Provide a baseline hover affordance for all clickable elements.

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

Support Forced Colors Mode

Ensure buttons remain visible in Windows High Contrast Mode by adding explicit borders.

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

Enable Smooth Scrolling Conditionally

Apply smooth scrolling only when the user hasn't requested reduced motion.

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

Minimal Base Stylesheet

Here's a complete minimal base that incorporates all guidelines:

: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;
  }
}

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-30 23:56 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

security-compliance

Skill Vetter

spclaudehome
AI智能体技能安全预审工具。安装ClawdHub、GitHub等来源技能前,检查风险信号、权限范围及可疑模式。
★ 1,223 📥 267,397
ai-intelligence

self-improving agent

pskoett
捕获经验教训、错误及修正内容,以实现持续改进。适用于以下场景:(1)命令或操作意外失败;(2)用户纠正Claude(如“不,那不对……”“实际上……”);(3)用户请求的功能不存在;(4)外部API或工具出现故障;(5)Claude发现自身
★ 4,072 📥 805,481
ai-intelligence

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,373 📥 319,760