How to Use Water.css: A Guide for Simple Styling

Sep 2, 2021 | Programming

Welcome to this easy-to-follow guide on leveraging Water.css, a drop-in collection of CSS styles designed to elevate the look of simple websites without requiring extensive styling effort.

What is Water.css?

Water.css is a CSS framework that enables developers to quickly turn their simple static pages or demo websites into visually appealing designs. You just include Water.css in your head tag, and it takes over to make everything look nicer.

Getting Started with Water.css

Integrating Water.css is as simple as pie! Here’s how you can do it in a few steps:

Step 1: Include Water.css in Your HTML

You’ll need to add one of the links below to the <head> section of your HTML:

  • 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">

Step 2: Explore Automatic Theme Switching

Water.css automatically switches between light and dark mode based on the user’s device preferences using a CSS media query called prefers-color-scheme. If a user’s preference can’t be detected, it defaults to light mode.

Theming Your Website

If you want to customize the theme, Water.css allows you to change various CSS variables. You can override default values using your own stylesheet:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.min.css">
<style>
    :root {
        --links: red; /* Change link color to red */
    }
</style>

Troubleshooting

  • If your styles aren’t reflective in the browser, ensure that your custom stylesheet is loaded after Water.css in the HTML head.
  • For Internet Explorer 11 users, be aware that the main Water.css file will lock to light mode. You may need to compile your own theme for custom features.
  • Check the compatibility notices mentioned in the documentation for any other browser-related issues.
  • Still stuck? For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Conclusion

Water.css is a fantastic tool when you need quick styling without extensive effort. It’s lightweight, responsive, and perfect for simple projects.

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox