Something went wrong. Try again.
A minimal, classless CSS framework that conveys structure through typography and spacing alone. fogtype.tngl.io/css
Something went wrong. Try again.
Files
- HTML 77%
- CSS 23%
README.md
# @fogtype/css
**English** | [日本語](README.ja.md)
A minimal, classless CSS framework that conveys structure through typography and spacing alone.
Semantic HTML (`<h1>` / `<p>` / `<table>` / `<form>` …) turns into a polished layout as-is. Designed for CJK with mixed CJK and Latin text in mind, it uses `text-autospace` to automatically insert spacing between CJK and Latin characters, a margin rhythm based on `rlh` (root line-height), and a flat, shadow-free aesthetic.
## Overview
- **Readability** - The body width is constrained with `ric` (character-width based) to adapt to full width without breakpoints, with a flat, shadow-free aesthetic
- **Classless** - Plain HTML is styled as-is. Themes can be swapped simply by overriding the CSS variables on `:root` (single file, zero dependencies)
- **CJK support** - `text-autospace` adjusts spacing between CJK and Latin characters, and `text-spacing-trim` handles the spacing around punctuation automatically
To see it in action, view the [preview](https://kou029w.github.io/css/preview.html).
## Usage
### HTML (CDN)
Just add one line to your `<head>`.
```html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fogtype/css" />
```
Then write semantic HTML.
```html
<!doctype html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fogtype/css" />
</head>
<body>
<h1>Heading</h1>
<p>
Body text is styled without any classes. Mixed 日本語 and English is
auto-adjusted too.
</p>
</body>
</html>
```
### NPM
```sh
npm install @fogtype/css
```
To pull it in through a bundler:
```css
@import "@fogtype/css";
```
```js
import "@fogtype/css";
```
To use a local copy, just drop in [`index.css`](./index.css) as-is. It has no dependencies.
## Themes
Every theme is **declared as CSS variables (custom properties) on `:root`**. Color, typography, spacing, and corner radius all derive from this set of variables,…