Configs2026年7月28日·1 分钟阅读

modern-normalize — Modern CSS Reset for Consistent Browser Defaults

modern-normalize is a small CSS file that normalizes browser default styles using only modern best practices, providing a clean baseline for web projects without legacy browser hacks.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
modern-normalize Overview
直接安装命令
npx -y tokrepo@latest install 4cb5954b-8a83-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

Introduction

modern-normalize is a CSS normalization library that fixes inconsistencies between browser default stylesheets. Unlike older resets, it targets only modern browsers and avoids opinionated style overrides, giving you a predictable baseline without stripping useful defaults.

What modern-normalize Does

  • Normalizes default margins, paddings, and font sizes across Chrome, Firefox, Safari, and Edge
  • Fixes known cross-browser rendering inconsistencies for form elements, tables, and media
  • Sets box-sizing to border-box on all elements for predictable layout calculations
  • Preserves useful browser defaults like list styles and heading hierarchy
  • Weighs under 1 KB gzipped, adding negligible overhead to any project

Architecture Overview

modern-normalize is a single CSS file with carefully ordered rule sets that target specific browser inconsistencies. Each rule includes inline comments documenting which browser behavior it addresses. The file is distributed via npm and can be imported as a CSS module or linked directly. It has zero JavaScript dependencies and zero runtime cost beyond a single stylesheet.

Self-Hosting & Configuration

  • Install via npm, yarn, or pnpm: npm install modern-normalize
  • Import at the top of your main CSS file: @import 'modern-normalize'
  • Alternatively, copy the CSS file directly into your project's static assets
  • Works with any CSS preprocessor (Sass, Less, PostCSS) or bundler (Vite, webpack)
  • No configuration needed; the file is ready to use as-is

Key Features

  • Targets only modern evergreen browsers, eliminating legacy IE workarounds
  • Applies border-box sizing globally for intuitive width and height behavior
  • Normalizes form control rendering across browsers without opinionated styling
  • Corrects inconsistent line-height and font-family inheritance in all browsers
  • Maintained by Sindre Sorhus with a focus on minimal, well-documented changes

Comparison with Similar Tools

  • normalize.css — The original normalizer with broader legacy browser support; modern-normalize is smaller and modern-only
  • CSS Reset (Meyer) — Strips all defaults aggressively; modern-normalize preserves useful defaults
  • sanitize.css — Opinionated reset with additional defaults; modern-normalize is less opinionated
  • Tailwind Preflight — Tailwind's built-in reset based on modern-normalize with additional opinions
  • Pico CSS — Classless CSS framework that goes beyond normalization into component styling

FAQ

Q: Should I use modern-normalize or normalize.css? A: Use modern-normalize if you only target evergreen browsers. Use normalize.css if you need IE 11 or other legacy browser support.

Q: Does modern-normalize conflict with CSS frameworks? A: No. It provides a baseline that frameworks build upon. Many frameworks like Tailwind CSS use modern-normalize internally.

Q: Can I customize which normalizations are applied? A: The file is small enough to copy and edit directly. Remove any rules you do not need or override them in your own stylesheet.

Q: Does it include any JavaScript? A: No. modern-normalize is pure CSS with no JavaScript, no build step, and no runtime dependencies.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产