# dev.css

[![NPM Version](https://img.shields.io/npm/v/@intergrav/dev.css)](https://www.npmjs.com/package/@intergrav/dev.css) [![jsDelivr hits (npm)](https://img.shields.io/jsdelivr/npm/hm/@intergrav/dev.css)](https://cdn.jsdelivr.net/npm/@intergrav/dev.css/) [![Discord](https://img.shields.io/discord/1262738186338308126?logo=discord&logoColor=%23fff&color=%235865F2)](https://discord.gg/m5tUgaM3uK) [![GitHub Repo stars](https://img.shields.io/github/stars/intergrav/dev.css)](https://tangled.org/devins.page/dev.css)

A tiny, classless CSS framework inspired by [new.css](https://newcss.net). Drop it in and any plain HTML file becomes modern and responsive. The minified stylesheet weighs ~4.8kb.

Good for simple blogs, personal sites, link pages, and HTML prototyping. Not meant for very complex web apps or sites, though you can build from it.

Website and demo: <https://devcss.devins.page>

<details>
<summary>Preview (not completely up-to-date im lazy)</summary>
<img src=".tangled/static/preview-desktop-light.png" alt="dev.css desktop demo, light mode">
<img src=".tangled/static/preview-desktop-dark.png" alt="dev.css desktop demo, dark mode">
<img height="748px" src=".tangled/static/preview-mobile-light.png" alt="dev.css mobile demo, light mode">
<img height="748px" src=".tangled/static/preview-mobile-dark.png" alt="dev.css mobile demo, dark mode">
</details>

If you use dev.css, feel free to add the badge:

```html
<a href="https://devcss.devins.page"
	><img
		src="https://cdn.jsdelivr.net/npm/@intergrav/dev.css@6/badge.svg"
		alt="powered by dev.css"
/></a>
```

<a href="https://devcss.devins.page"><img src="https://cdn.jsdelivr.net/npm/@intergrav/dev.css@6/badge.svg" alt="powered by dev.css" /></a>

## Installing

### HTML

```html
<link
	rel="stylesheet"
	href="https://cdn.jsdelivr.net/npm/@intergrav/dev.css@6"
/>
```

### npm / pnpm / etc

```sh
npm add @intergrav/dev.css

pnpm add @intergrav/dev.css
```

You can also load a font from [fontsource.org](https://fontsource.org) if you want a consistent font. By default, system sans-serif and monospace fonts are used.

## Structure

dev.css uses semantic HTML. Here's the recommended page structure:

```html
<html>
	<head>
		...
	</head>
	<body>
		<header>...</header>
		<aside>...</aside>
		<main>...</main>
		<footer>...</footer>
	</body>
</html>
```

### Header

Place a `<header>` at the top of `<body>`. Use `<h1>` for the site title, `<p>` for an optional description, and `<nav>` for navigation.

Traditional nav:

```html
<header>
	<h1>Website Title</h1>
	<p>An optional description.</p>
	<nav>
		<ul>
			<li><a href="#">Demo</a></li>
			<li><a href="#">GitHub</a></li>
		</ul>
	</nav>
</header>
```

![Example of a header using traditional navigation](.tangled/static/header-traditional.png)

Breadcrumb nav (recommended with `header-oneline.css`, move `<h1>` to `<main>` in that case):

```html
<header>
	<nav>
		<a href="../..">dev.css</a> / <a href="..">Blog</a> / Making a Website
	</nav>
	<h1>Making a Website</h1>
</header>
```

![Example of a header using breadcrumb navigation](.tangled/static/header-breadcrumb.png)

### Main

Wrap your page content in `<main>`. Required for the sidebar layout and recommended for SEO.

```html
<main>
	<h1>Page Title</h1>
	<p>Content goes here.</p>
</main>
```

### Sidebar

Place an `<aside>` before `<main>` for a sidebar. Up to two sidebars are supported, the second appears on the right. Wrap contents in `<details>` to make it collapsible. If you'd like to make it look like a container, you can wrap the contents inside `<aside>` with an `<article>`.

```html
<aside>
	<details open>
		<summary>Sidebar</summary>
		<nav>
			<ul>
				<li><a href="#">Page 1</a></li>
				<li><a href="#">Page 2</a></li>
			</ul>
		</nav>
	</details>
</aside>
```

### Footer

Place a `<footer>` at the bottom of `<body>`. Formats nav the same way as the header.

### Text elements

- Body text: `<p>`
- Quotes: `<blockquote>`
- Highlighted text: `<mark>`
- Inline code: `<code>`
- Code blocks: `<pre><code>`
- Keyboard input: `<kbd>`
- Dropdowns: `<details>` / `<summary>`

For more HTML elements, see [W3Schools/html](https://www.w3schools.com/html/).

## Addons

Small CSS/JS snippets that add or adjust functionality.

### `header-oneline.css`

Makes the header compact and horizontally laid out.

```html
<link
	rel="stylesheet"
	href="https://cdn.jsdelivr.net/npm/@intergrav/dev.css@6/addon/header-oneline.min.css"
/>
```

### `header-sticky.css`

Makes the header stick to the top of the screen. Recommended for small headers, pair with `header-oneline.css` for best results.

```html
<link
	rel="stylesheet"
	href="https://cdn.jsdelivr.net/npm/@intergrav/dev.css@6/addon/header-sticky.min.css"
/>
```

### `scroll-to-top.js`

Adds a small scroll-to-top button in the bottom right corner when the user scrolls down.

```html
<script
	src="https://cdn.jsdelivr.net/npm/@intergrav/dev.css@6/addon/scroll-to-top.min.js"
	defer
></script>
```

### `responsive-sidebar.js`

Auto-opens/closes `<details>` inside sidebars at wide viewports.

```html
<script
	src="https://cdn.jsdelivr.net/npm/@intergrav/dev.css@6/addon/responsive-sidebar.min.js"
	defer
></script>
```

## Themes

Apply a theme after the dev.css import. Can modify colors, fonts, and other variables.

```html
<link
	rel="stylesheet"
	href="https://cdn.jsdelivr.net/npm/@intergrav/dev.css@6/theme/terminal.user.min.css"
/>
```

Available built-in themes: `day`, `night`, `terminal`, `catppuccin-mocha`, `catppuccin-frappe`, `catppuccin-macchiato` (Latte is included for light mode in each of the catppuccin themes for accessibility). To make your own, see `boilerplate.user.css`.

Themes can also be installed as userstyles (e.g. via Stylus) to apply to any site using dev.css.

## Credits

- [xz/new.css](https://github.com/xz/new.css) for being a major inspiration
- [Catppuccin](https://github.com/catppuccin) for the colors used in the Catppuccin themes
