
In web page design, LQIPs ( Low-quality image placeholders ) are prevalent. There are many different solutions, but the main issue is that creating them frequently leans toward things like JavaScript, necessitates extended chunks of unintelligible password or other trade-offs. In pure CSS, [ Lean ] came up with a simple, elegant solution to create LQIPs.
Here’s how it works: all required data is packed into a single CSS integer, which is decoded directly in CSS (no need for any JavaScript) to dynamically generate an image that renders immediately. Another benefit is that without any need for wrappers or long strings of data this method avoids cluttering the HTML. The code is little more than a line like
which is certainly tidy, as well as a welcome boon to those who hand-edit files.
The key to creating LQIPs from scratch is to produce an output that isn’t jarring in its structure or hard on the eyes. Lean ] made numerous experiments before settling on an compression technique that consistently produced easy color variations and balance.
Using just CSS, this approach transforms a single integer into a perfectly-usable LQIP. Even a separate tool [ Lean ] was created to compress any given image into the chosen integer format ( so the end result will appear as a blurred copy of the original image ). Although the code is simple, clean, and the technique is simple to implement, the results may appear very blurry. In [ Lean ]’s , you can see it in action.
CSS has a lot of potential, and it’s worthy of much more than just styling and lining up parts. How about using geometric CSS? Or, to go one way, try implementing a CSS ( and HTML) configuration .