CSS Houdini introduction & future of CSS
Tags: css, webdev, tutorial, javascript
Published: 2020-06-15 05:09:45

---
title: CSS Houdini introduction & future of CSS
published: true
description: Houdini, an umbrella term for the collection of browser APIs, aims to bring significant improvements to the web development process and the development of CSS standards in general. Frontend developers will be able to extend the CSS with new features using JavaScript, hook into CSS rendering engine and tell the browser how to apply CSS during a render process. 
tags: css, webdev, tutorial, javascript
series: A Practical Overview Of CSS Houdini
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/byaag03z37wzbfuq4e5c.jpg
canonical_url: https://www.smashingmagazine.com/2020/03/practical-overview-css-houdini
---
<small>
This post has been [originally published on Smashing Magazine](https://www.smashingmagazine.com/2020/03/practical-overview-css-houdini/) and I decided to split it into parts to make it more digestible. I'll be converting the post into markdown and publish a part of it on DEV every week. If you want to read it right away in its entirety, feel free to read it on Smashing Magazine until all parts are available on DEV. Thank you.</small>
<hr />

It takes a long time for a new CSS feature or improvement to progress from an initial draft to a fully-supported and stable CSS feature that developers can use. JavaScript-based polyfills can be used as a substitute for the lack of browser support in order to use new CSS features before they’re officially implemented. But they are flawed in most cases. For example, [scrollsnap-polyfill](https://github.com/ckrack/scrollsnap-polyfill/) is one of several polyfills that can be used to fix browser support inconsistencies for the CSS Scroll Snap specification. But even that solution has some limitations, bugs and inconsistencies.

The potential downside to using polyfills is that they can have a [negative impact on performance](https://philipwalton.com/articles/the-dark-side-of-polyfilling-css/) and are difficult to implement properly. This downside is related to the browser’s DOM and CSSOM. Browser creates a **DOM (Document Object Model)** from HTML markup and, similarly, it created **CSSOM (CSS Object Model)** from CSS markup. These two object trees are independent of one another. JavaScript works on DOM and has very limited access to CSSOM.

JavaScript Polyfill solutions run only after the initial render cycle has been completed, i.e. when both DOM and CSSOM have been created and the document has finished loading. After Polyfill makes changes to styles in the DOM (by inlining them), it causes the render process to run again and the whole page re-renders. Negative performance impact gets even more apparent if they rely on the `requestAnimationFrame` method or depend on user interactions like scroll events.

Another obstacle in web development is various **constraints imposed by the CSS standards**. For example, there are only a limited number of CSS properties that can be natively animated. CSS knows how to natively animate colors, but doesn’t know how to animate gradients. There has always been a need to innovate and create impressive web experiences by pushing the boundaries despite the tech limitations. That is why developers often tend to gravitate towards using less-than-ideal workarounds or JavaScript to implement more advanced styling and effects that are currently not supported by CSS such as masonry layout, advanced 3D effects, advanced animation, fluid typography, animated gradients, styled `select` elements, etc.

It seems **impossible for CSS specifications to keep up** with the various [feature demands from the industry](https://twitter.com/jensimmons/status/1062834380563828736) such as more control over animations, improved text truncation, better styling option for `input` and `select` elements, more `display` options, more `filter` options, etc.

What could be the potential solution? Give developers a **native way of extending CSS** using various APIs. In this article, we are going to take a look at how frontend developers can do that using Houdini APIs, JavaScript, and CSS. In each section, we’re going to examine each API individually, check its browser support and current specification status, and see how they can be implemented today using Progressive enhancement.

#What Is Houdini?

Houdini, an umbrella term for the collection of browser APIs, aims to bring significant improvements to the web development process and the development of CSS standards in general. Developers will be able to extend the CSS with new features using JavaScript, hook into CSS rendering engine and tell the browser how to apply CSS during a render process. This will result in significantly better performance and stability than using regular polyfills.

Houdini specification consists of two API groups - **high-level APIs** and **low-level APIs**.

**High-level APIs** are closely related to the browser’s rendering process (style → layout → paint → composite). This includes:

- **Paint API** - An extension point for the browser’s paint rendering step where visual properties (color, background, border, etc.) are determined.
- **Layout API** - An extension point for the browser’s layout rendering step where element dimensions, position, and alignment are determined.
- **Animation API** - An extension point for browser’s composite rendering step where layers are drawn to the screen and animated.

**Low-Level APIs** form a foundation for high-level APIs. This includes:

- Typed Object Model API
- Custom Properties & Values API
- Font Metrics API
- Worklets

Some Houdini APIs are already available for use in [some browsers](https://ishoudinireadyyet.com/) with other APIs to follow suit when they’re ready for release.

# The Future Of CSS

Unlike regular CSS feature specifications that have been introduced thus far, Houdini stands out by allowing developers to extend the CSS in a more native way. Does this mean that CSS specifications will stop evolving and no new official implementations of CSS features will be released? Well, that is not the case. Houdini’s goal is to aid the CSS feature development process by allowing developers to create working prototypes that can be easily standardized.

Additionally, developers will be able to share the open-source CSS Worklets more easily and with less need for browser-specific bugfixes.

<hr />

These articles are fueled by coffee. So if you enjoy my work and found it useful, consider buying me a coffee! I would really appreciate it.

<a href="https://www.buymeacoffee.com/ubnZ8GgDJ" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-red.png" alt="Buy Me A Coffee" style="height: 51px !important;width: 217px !important;" ></a>

Thank you for taking the time to read this post. Keep an eye out for the next part in the series. If you've found this useful, please give it a ❤️ or 🦄, share and comment.