@exampledev/new.css

中文文档
1.1.3发布于 2020/05/20MIT零依赖近 30 天下载 2180

A classless CSS framework to write modern websites using only HTML.

原始使用文档
文档目录16 节
  1. Table of Contents
  2. Usage
  3. HTML
  4. npm
  5. Use Cases
  6. Details
  7. Element Guide
  8. Themes
  9. Customizing
  10. Legend
  11. Usage
  12. Pre-Made Themes
  13. Night
  14. Terminal
  15. Sponsors
  16. Special Thanks

new.css

newcss.net / xz Discord / Twitter

A classless CSS framework to write modern websites using only HTML. It weighs ~4.5kb.

Take a look at the demo on newcss.net, or the quick-start guide on newcss.net/usage. It's on npm as @exampledev/new.css.

Vercel's impossibly fast CDN delivers the font Inter using xz/fonts, so there's virtually no bloat added to your pages.

And of course, there's a dark mode. It automatically applies a light/dark theme based on your browser's preference.

It supports custom color themes and fonts using CSS variables. For example, check out the terminal theme: newcss.net/theme/terminal/

new.css is a project from xz.

Table of Contents

Usage

Here's your configuration:

HTML

Add this code to the end of your <head>:

<link rel="stylesheet" href="https://fonts.xz.style/serve/inter.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@exampledev/[email protected]/new.min.css">

💡 new.css is best with the font Inter, which the line above imports as well. Use this line instead if you prefer no added fonts:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@exampledev/[email protected]/new.min.css">

npm

Or, if you prefer npm:

  1. npm -i @exampledev/new.css

Use Cases

  • A dead-simple blog
  • Collecting your most used links
  • Making a simple "about me" site
  • Rendering markdown-generated HTML

Details

Element Guide

How to use some of new.css' semantic HTML features.

  • button
    • Wrap a button in an <a> tag to make it a link.
  • Code
    • For inline code, use <code>.
    • For code blocks, use <pre>.
    • For keyboard input, use <kbd>,
    • There's no reason to nest code tags inside each other, however, <code> and <pre> will reset themselves to match if you nest them.
  • header
    • Only use a <header> at the top of your <body>!
    • Creates a large and slightly darker header.

Here are the improvements new.css adds to your browser's basic HTML.

Full Changes
  • Global
    • Slightly increase all text sizes
    • Use a less harsh color scheme
    • Use the Inter font, and if not possible, the system font
    • Redefine all margins to more sensible defaults
  • body
    • Set a reasonable max width
    • Centered the body element, keeping left-alignment
  • abbr
    • Question mark cursor on hover
  • blockquote
    • Improved margins
    • Added background color
  • button
    • Appears uniformly across browsers
    • Looks like a real button
  • code
    • Added background color
    • Added outline stroke
  • details
    • Looks more button-like with background color and link cursor on hover
  • h1–h6
    • Uniform margins and padding
    • Tweaked font size
  • h1-h3
    • Added thin bottom border line
  • hr
    • Changed to single 1px line
  • kbd
    • Looks like a real keyboard key
  • mark
    • Added padding
    • Color follows theme
  • nav
    • Added between-element margins
  • samp
    • Ambiguous element, merged with code
  • table
    • Basic styling to make cells more discernable
      • Border stroke across all cells
      • Alternating row background color

Themes

new.css uses an 10-color palette and can be easily customized. These are declared as a CSS variable in the :root attribute.

Customizing

By loading a secondary style sheet after new.css in your HTML, you can override these variables. Here's the default theme:

Default theme
@import url('https://fonts.xz.style/serve/inter.css');

:root {
    --nc-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    --nc-font-mono: 'Courier New', Courier, 'Ubuntu Mono', 'Liberation Mono', monospace;
    --nc-tx-1: #000000;
    --nc-tx-2: #1A1A1A;
    --nc-bg-1: #FFFFFF;
    --nc-bg-2: #F6F8FA;
    --nc-bg-3: #E5E7EB;
    --nc-lk-1: #0070F3;
    --nc-lk-2: #0366D6;
    --nc-lk-tx: #FFFFFF;
    --nc-ac-1: #79FFE1;
    --nc-ac-tx: #0C4047;
}

Legend

  • --nc-font-sans: Font for all text besides code or preformatted
  • --nc-font-mono: Font for <code>, <pre>, <kbd>, <samp>
  • --nc-tx-1: Heading text color
  • --nc-tx-2: Body text color
  • --nc-bg-1: Base background color
  • --nc-bg-2: Slightly darker background color
  • --nc-bg-3: Even slightly darker background color
  • --nc-lk-1: Action color for links and buttons
  • --nc-lk-2: Link and buttons on mouse hover and active
  • --nc-ac-1: Accent color for <mark> and text selection background

Usage

  1. Create a stylesheet including some or all of the above variables in the :root. An example theme file is available here: boilerplate.css
  2. If you'd like to import custom fonts, put the @import tag before the :root element. Many open-source fonts are available on xz/fonts.
  3. Reference your new stylesheet after new.css in your <head>. Here's an example <head>:
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@exampledev/[email protected]/new.min.css">">
    <link rel="stylesheet" href="https://example.com/MY-CUSTOM-THEME.css">
</head>

Pre-Made Themes

Here are two extra themes with CDN links. Feel free to use or edit them!

Night

<link rel="stylesheet" href="https://newcss.net/theme/night.css">

Preview at newcss.net/theme/night/

Night theme

Terminal

<link rel="stylesheet" href="https://newcss.net/theme/terminal.css">

Preview at newcss.net/theme/terminal/

Terminal theme

Sponsors

Special Thanks




Powered by Vercel

版本与发布记录

@exampledev/new.css 共发布 6 个版本,首次发布于 2020/05/18;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.1.3latest2020/05/206 年前
1.1.22020/05/206 年前
1.1.12020/05/206 年前
1.1.02020/05/206 年前
1.0.12020/05/196 年前
1.0.02020/05/186 年前

关于 @exampledev/new.css 的常见问题

@exampledev/new.css 是什么?

A classless CSS framework to write modern websites using only HTML.

如何安装 @exampledev/new.css?

在项目目录运行 npm install @exampledev/new.css,或使用 pnpm add / yarn add / bun add。

@exampledev/new.css 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/exampledev__new.css 是否存在。

@exampledev/new.css 可以商用吗?

@exampledev/new.css 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@exampledev/new.css 的下载量有多少?

根据 npm 官方下载统计,@exampledev/new.css 在 2026/10/14 – 2026/11/12 这 30 天内被下载 2,180 次,日均约 73 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@exampledev/new.css 还在维护吗?

最新版本 1.1.3 发布于 2020/05/20(6 年前);至今共发布 6 个版本,其中过去 12 个月发布了 0 个;首次发布于 2020/05/18。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。