Navigating the High Seas of CSS Anchor Positioning

Lawrence Chabela CSS & HTML, Design, Development Technologies, HTML5 Leave a Comment

Navigating the seas of web development, the CSS Anchor Positioning API has emerged as a foundational tool, enabling developers to anchor elements precisely relative to others. This blog post explores key concepts such as anchor elements and anchor-positioned elements, demonstrating how to set up relationships between elements, utilize the anchor() function for positioning, and leverage the new anchor-center value for effortless centering. Advanced techniques like multiple anchors, the inset-area property, the anchor-size() function, and visibility options are also covered.

:Has Selector

Exploring the New :has Pseudo Selector and Its Uses

Lawrence Chabela CSS & HTML, Design, Development Technologies Leave a Comment

Through the years, we were told a parent selector would be an engineering feat that could not be achieved due to the way browsers render a page and apply computed styles to elements as a stream, one element after the other. When the browser paints a parent and inevitably its children, reevaluating this already-painted DOM to evaluate parents for children containing a particular context would be too expensive of a task.

As the years moved on, we all applied different hacks or strategies, either reworking our DOM to avoid the issue altogether or using various JavaScript techniques to select parents and add CSS classes to use instead. We were just waiting for something to save us…

Preventing Layout Shift

Using CSS Grid to Prevent Page Jank

Lawrence Chabela CSS & HTML, Design, JavaScript, Programming, Tutorial Leave a Comment

Layout shifts, or page jank as I like to call it, rears its ugly head when a visible element changes position or dimensions, causing the position or dimensions of content around it to be changed.

There are too many possible reasons behind a layout shift to cover in one post, so I’ve narrowed it down to one in particular for the sake of brevity. In this article, we will discuss this scenario: a component changing its height due to its state being changed from user interaction.

I know that this is a relatively isolated example, especially in the grand scheme of things. However, I think this proves an important point. Solving a layout shift doesn’t always have to be a tedious and complicated process to fix. Sometimes, scenarios like this can easily be solved using the CSS we already have at our disposal.

CSS Grid with CSS Math means no media queries

CSS Grid + CSS Math Expressions = Look Ma No Media Queries

Lawrence Chabela CSS & HTML, Design, Development Technologies, JavaScript Leave a Comment

CSS Grid has been the new, cool kid on the block for a few years now. Grid, with its layout algorithm, has given us so many more capabilities in how we can layout and arrange content in our applications.

CSS Grid allows us to define layout patterns in concise and refined ways. That being said, we simply cannot look at CSS Grid by itself without knowing how other key features of modern CSS (like Math expressions) work with CSS Grid. This can allow us to push the boundaries and create more efficient layouts.

These new layout superpowers enable us to start to move past the constraints and limitations that media queries have.

Progressive Web Apps Tips and Tricks

Progressive Web App Tips and Tricks

John Boardman CSS & HTML, HTML5 4 Comments

PWA (Progressive Web App) is a powerful solution to multiple problems. Prior to PWA, there were some browser-specific implementations to some of the problems solved by PWA, but PWA is much more elegant while solving more problems at the same time.

In this post, we’ll cover the problems PWA was created to solve, some of the solutions PWA replaced, tools that make PWA development faster and more flexible, and tips to get the most out of PWA development.