GitHub - kognise/water.css: A drop-in collection of CSS styles to make simple websites just a little nicer

NPM page On Product Hunt Contributors MIT license

๐ŸŒŠ A drop-in collection of CSS styles to make simple websites just a little nicer

Water.css


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! โšก[1]

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[2]. 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[3], 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[4].

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[5]!

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[6] 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[7] to learn how to get started.
And thanks for taking the time to contribute! :)

keywords

No Items Found.

Add Comment
Type in a Nick Name here
 
Other Items in webdev
Font Awesome Icons [ Icons ] - CSS Bundle Daily Dev Tips CSS Background Patterns by MagicPattern GitHub - ganlanyuan/tiny-slider: Vanilla javascript slider for all purposes. GitHub - jonasstrehle/supercookie: โš ๏ธ Browser fingerprinting via favicon! URL-encoder for SVG Bootstrap Icons ยท Official open source SVG icon library for Bootstrap GitHub - kognise/water.css: A drop-in collection of CSS styles to make simple websites just a little nicer Toggle light and dark themes in Bootstrap - DEV Deploy your Publish website for free on GitHub Pages - DEV Bootstrap ยท The most popular HTML, CSS, and JS library in the world. GitHub - diegocard/awesome-html5: A curated list of awesome HTML5 resources Fixing PHP SQLite database is locked warning - Unable to execute statement: database is locked [ php ] - KruXoR openstreetmap.org 50 Developer tools to make your life a little easier https://www.mrlacey.com/2020/07/youve-only-added-two-lines-why-did-that.html?m=1 GitHub - ForEvolve/bootstrap-dark: Bootstrap 4 dark theme that supports togging dark/light themes as well. There is no fluff, it changes the color of Bootstrap and that's it, no new thing to learn or unlearn, just Bootstrap, but Dark! Responsive Web Design Online Testing - isResponsive Trianglify.io ยท Low Poly Pattern Generator Grid.js - Advanced table plugin HEAD - A free guide to <head> elements Roots | Modern WordPress Development Tools A Local Dev Tool For Every Project | Lando new.css Synchronized responsive testing, development, inspection |ย Vanamco Gold Price Charts Widgets | GoldBroker.com Trianglify.io ยท Low Poly Pattern Generator Special tags that Google understands - Search Console Help 404 Error Page Codepen ScrollMagic โ™ฅ Demo AOS - Animate on scroll library Font Awesome v4.7.0 - Icon Search Tool Carbon Offers โ€” LowEndTalk Featherlight โ€“ The ultra slim jQuery lightbox. Tailwind CSS - A Utility-First CSS Framework for Rapidly Building Custom Designs HEAD - A free guide to <head> elements API Blueprint | API Blueprint Filtering Data Client-Side: Comparing CSS, jQuery, and React | CSS-Tricks CSS Quickies: CSS Variables - Or how you create a ๐ŸŒžwhite/๐ŸŒ‘dark theme easily - DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป Responsive Slider Timeline Colormind - the AI powered color palette generator Get Waves โ€“ Create SVG waves for your next design Nuxt.js - The Vue.js Framework CodeSandbox: Online Code Editor Tailored for Web Application Development Hover.css - A collection of CSS3 powered hover effects Live.js - One script closer to Designing in the Browser Color this sofa! โ€“ SVG + Blend Mode trick You Might Not Need jQuery CSS Wave Animation with a .png
Search Linx
Search Linx by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. โ˜•

โค๏ธ๐Ÿ‘ฉโ€๐Ÿ’ป๐ŸŽฎ

๐Ÿชฆ 2000 - 16 Oct 2022 - Boots
Random Quote
Interesting...

Me
Random CSS Property

overflow-clip-margin

The overflow-clip-margin CSS property determines how far outside its bounds an element with overflow: clip may be painted before being clipped.
overflow-clip-margin css reference