water.css
A drop-in collection of CSS styles to make simple websites just a little nicer
Top Related Projects
A tiny modern CSS reset
A modern alternative to CSS resets
:cherry_blossom: a minimal css framework/theme.
MVP.css — Minimalist classless CSS stylesheet for HTML elements
Simple.css is a CSS template that allows you to make a good looking website really quickly.
A micro (3kb) CSS framework
Quick Overview
Water.css is a lightweight CSS framework that provides a set of default styles to make HTML look beautiful with minimal effort. It's designed to be drop-in ready, requiring no classes or complex setup, making it ideal for quickly styling simple websites or prototypes.
Pros
- Extremely easy to use with no configuration required
- Lightweight and fast-loading (< 2kb gzipped)
- Automatically adapts to light and dark modes
- Responsive design out of the box
Cons
- Limited customization options compared to more comprehensive frameworks
- Not suitable for complex layouts or highly designed websites
- Lack of pre-built components (e.g., navigation bars, cards)
- May conflict with existing styles in more established projects
Code Examples
- Basic usage:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css">
This code snippet adds Water.css to your HTML file using a CDN link.
- Customizing the theme:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/light.css">
This example shows how to use the light theme specifically, instead of the auto-switching default theme.
- Using with a custom color scheme:
<style>
:root {
--background-body: #f1f1f1;
--text-main: #1a1a1a;
--primary: #0077ff;
}
</style>
This CSS snippet demonstrates how to override Water.css default colors using CSS custom properties.
Getting Started
To use Water.css in your project, simply add the following line to the <head>
section of your HTML file:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css">
That's it! Your HTML elements will now be styled using Water.css. No additional classes or configuration is needed. You can start writing your HTML content, and it will automatically look good on both light and dark modes.
Competitor Comparisons
A tiny modern CSS reset
Pros of minireset.css
- Extremely lightweight (only 108 bytes minified and gzipped)
- Focuses solely on resetting default browser styles
- Provides a clean slate for custom styling without imposing any design choices
Cons of minireset.css
- Lacks pre-styled elements, requiring more custom CSS for basic styling
- Does not provide any responsive design features out of the box
- May require additional CSS normalization for cross-browser consistency
Code Comparison
minireset.css:
html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}
h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}
ul{list-style:none}
water.css:
body {
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
line-height: 1.4;
max-width: 800px;
margin: 20px auto;
padding: 0 10px;
color: #363636;
background: #ffffff;
text-rendering: optimizeLegibility;
}
The code comparison shows that minireset.css focuses on resetting default styles, while water.css provides more opinionated styling for basic elements.
A modern alternative to CSS resets
Pros of normalize.css
- More widely adopted and battle-tested in production environments
- Focuses on preserving useful browser defaults, making it less opinionated
- Smaller file size, leading to faster load times
Cons of normalize.css
- Requires additional styling for a complete design system
- Less visually appealing out-of-the-box compared to water.css
- May need more customization for modern design trends
Code Comparison
normalize.css:
html {
line-height: 1.15;
-webkit-text-size-adjust: 100%;
}
body {
margin: 0;
}
water.css:
body {
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
line-height: 1.4;
max-width: 800px;
margin: 20px auto;
padding: 0 10px;
color: #363636;
background: #ffffff;
}
normalize.css provides a minimal reset, while water.css offers more opinionated styling out-of-the-box. normalize.css is better suited for projects requiring a clean slate, whereas water.css is ideal for quickly creating visually appealing prototypes or simple websites without additional CSS.
:cherry_blossom: a minimal css framework/theme.
Pros of Sakura
- More opinionated design with a distinct aesthetic
- Includes print styles for better paper output
- Smaller file size (8.2 KB vs 11.6 KB for Water.css)
Cons of Sakura
- Less extensive browser support (no IE11)
- Fewer customization options and variables
- Limited documentation compared to Water.css
Code Comparison
Sakura:
html {
font-size: 62.5%;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}
Water.css:
body {
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
line-height: 1.4;
max-width: 800px;
margin: 20px auto;
padding: 0 10px;
color: #363636;
background: #ffffff;
text-rendering: optimizeLegibility;
}
Both projects aim to provide simple, classless CSS frameworks for quick styling of HTML. Sakura offers a more opinionated design with a focus on simplicity, while Water.css provides more extensive customization options and broader browser support. The code comparison shows that Water.css includes more detailed default styling for the body element, while Sakura focuses on setting a base font size and family for the entire document.
MVP.css — Minimalist classless CSS stylesheet for HTML elements
Pros of MVP
- More comprehensive styling, including navigation, cards, and tables
- Includes a dark mode option out of the box
- Offers more customization options through CSS variables
Cons of MVP
- Larger file size, potentially impacting page load times
- More opinionated design, which may require more overrides for custom styling
- Steeper learning curve due to more features and options
Code Comparison
MVP:
:root {
--border-radius: 5px;
--box-shadow: 2px 2px 10px;
--color: #118bee;
--color-accent: #118bee15;
--color-bg: #fff;
--color-bg-secondary: #e9e9e9;
--color-secondary: #920de9;
--color-secondary-accent: #920de90b;
--color-shadow: #f4f4f4;
--color-text: #000;
--color-text-secondary: #999;
--font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
--hover-brightness: 1.2;
--justify-important: center;
--justify-normal: left;
--line-height: 1.5;
--width-card: 285px;
--width-card-medium: 460px;
--width-card-wide: 800px;
--width-content: 1080px;
}
Water.css:
:root {
--background-body: #fff;
--background: #efefef;
--background-alt: #f7f7f7;
--selection: #9e9e9e;
--text-main: #363636;
--text-bright: #000;
--text-muted: #70777f;
--links: #0076d1;
--focus: #0096bfab;
--border: #dbdbdb;
--code: #000;
--animation-duration: 0.1s;
--button-hover: #ddd;
--scrollbar-thumb: rgb(213, 213, 213);
--scrollbar-thumb-hover: rgb(196, 196, 196);
--form-placeholder: #949494;
--form-text: #000;
--variable: #39a33c;
--highlight: #ff0;
}
Simple.css is a CSS template that allows you to make a good looking website really quickly.
Pros of Simple.css
- More lightweight and minimalistic approach
- Includes a dark mode option out of the box
- Offers better accessibility features
Cons of Simple.css
- Less extensive color palette and styling options
- Fewer pre-styled elements compared to Water.css
- Limited customization without modifying the core CSS
Code Comparison
Simple.css:
body {
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
line-height: 1.4;
max-width: 800px;
margin: 20px auto;
padding: 0 10px;
color: #363636;
background: #fff;
}
Water.css:
body {
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
line-height: 1.4;
max-width: 800px;
margin: 20px auto;
padding: 0 10px;
color: #363636;
background: #f1f1f1;
}
Both CSS frameworks aim to provide a simple, classless styling solution for quick prototyping or minimalist websites. While Simple.css focuses on extreme simplicity and accessibility, Water.css offers a slightly more comprehensive set of styles and color options. The choice between the two depends on the specific needs of the project and the desired level of customization.
A micro (3kb) CSS framework
Pros of Chota
- More comprehensive component library, including cards, tabs, and modals
- Customizable with CSS variables for easy theming
- Smaller file size (3.8KB gzipped) compared to Water.css (2KB minified)
Cons of Chota
- Requires additional classes for styling, less "classless" than Water.css
- More opinionated design, potentially less suitable for quick prototyping
- Lacks dark mode out of the box (Water.css offers automatic dark mode)
Code Comparison
Water.css (basic usage):
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css">
<button>Click me</button>
Chota (basic usage):
<link rel="stylesheet" href="https://unpkg.com/chota@latest">
<button class="button primary">Click me</button>
Both Water.css and Chota are lightweight CSS frameworks designed to make web development easier. Water.css focuses on providing a classless solution for quick prototyping and simple projects, while Chota offers a more feature-rich component library with customization options. Water.css is ideal for developers who want a no-fuss, instant styling solution, whereas Chota is better suited for those who need more control over their design and are willing to use classes for styling.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Water.css
ð A drop-in collection of CSS styles to make simple websites just a little nicer
Goals
- Responsive
- Themeable
- Good browser support (works on my old kindle's browser :P)
- Tiny size
- Beautiful
- No classes
Why?
I commonly make quick demo pages or websites with simple content. For these, I don't want to spend time styling them but don't like the ugliness of the default styles.
Water.css is a CSS framework that doesn't require any classes. You just include it in your <head>
and forget about it, while it silently makes everything nicer.
Who?
You might want to use Water.css if you're making a simple static page or demo website that you don't want to spend time styling.
Although it originally wasn't built for more complex websites, many developers have used Water.css as a base stylesheet and creatively applied custom styles to build out an entire app. Nothing is stopping you from doing the same!
How?
Just stick this in your <head>
:
ð/â Automatic Theme:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.min.css">
ð Dark Theme:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/dark.min.css">
â Light Theme:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/light.min.css">
A preview of the different themes is available on the demo page! â¡
How the "Automatic Theme" works
The main water.css
file automatically switches between light and dark mode depending on the system preferences of a user's device. This detection is made possible through a CSS media query called prefers-color-scheme
. In browsers where the preference can't be detected, water.css
will stick to the light theme.
If you want to avoid this behavior, use either dark.css
or light.css
.
Supporting Internet Explorer
All three distributions of Water.css support Internet Explorer 11, but the main water.css
file doesn't respect the user's color scheme and will be locked to light mode due to lack of prefers-color-scheme
support.
Be aware that IE also doesn't support runtime theming, and fixed fallback values will be used. If you want to override the Water.css theme in a way that's compatible with IE, we recommend that you compile your own theme.
Unminified builds
All versions are also available as unminified stylesheets, which can be handy during development.
Simply remove the .min
from the file name.
Theming
Do you want to make some adjustments or build your own theme completely different from the official dark or light themes? Since Water.css is built with CSS variables this is super easy to do! Here's a list list of all the variables you can change to your liking:
--background-body
--background
--background-alt
--selection
--text-main
--text-bright
--text-muted
--links
--focus
--border
--code
--animation-duration
--button-hover
--scrollbar-thumb
--scrollbar-thumb-hover
--form-placeholder
--form-text
--variable
--highlight
--select-arrow
Runtime theming
â If you use a version with support for legacy browsers like Internet Explorer, skip to Compiling your own theme!
Water.css uses Custom Properties ("CSS variables") to define its base styles such as colors. These can be changed and overwritten right in the browser.
Because of this, you can simply add your own stylesheet to the page and set your own CSS variables there. As long as your stylesheet comes after Water.css in the HTML, your values will override the default ones and your theme is applied!
This short example will use Water.css, but color all links red:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/water.css@2/out/water.min.css" />
<style>
:root {
--links: red;
}
</style>
If you want to change a value for dark or light mode only, use a media query like this:
<style>
:root {
--links: blue; /* Always applied */
}
@media (prefers-color-scheme: dark) {
:root {
--links: yellow; /* Only applied in dark mode (overrides blue) */
}
}
</style>
Compiling your own theme
If you are targeting browsers without support for CSS Custom Properties such as Internet Explorer, runtime theming is not an option. To apply your own theming, you'll need to make your changes in the source files themselves, then re-compile the CSS files. This works like the following:
- Clone the repository to your machine
- Run
yarn
to install dependencies - Make the theming changes you want in
src/variables-*.css
- Run
yarn build
to compile the CSS files - Use the compiled files in the
out/
directory on your site
You also might want to check out the Contributing Guide as it contains further information about the build setup.
Contributing
Water.css becomes better for everyone when people like you help make it better!
Check out our Contributing Guide to learn how to get started.
And thanks for taking the time to contribute! :)
Top Related Projects
A tiny modern CSS reset
A modern alternative to CSS resets
:cherry_blossom: a minimal css framework/theme.
MVP.css — Minimalist classless CSS stylesheet for HTML elements
Simple.css is a CSS template that allows you to make a good looking website really quickly.
A micro (3kb) CSS framework
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot