Select Page

Category: Article

Aspect Ratios for Grid Items

We’ve covered Aspect Ratio Boxes before. It involves trickery with padding such that an element’s width and height are in proportion to your liking. It’s not an ultra-common need, since fixing an element’s height is asking for trouble, but it comes up. One way to lower the risk is The Psuedo Element Tactic, in which a pseudo element pushes its parent element to the aspect ratio, but if the content inside pushes it taller, it will get taller, aspect ratio be damned. You can use that technique in CSS grid with grid items! Although there are a couple of...

Read More

Content Security Policy: The Easy Way to Prevent Mixed Content

I recently learned about a browser feature where, if you provide a special HTTP header, it will automatically post to a URL with a report of any non-HTTPS content. This would be a great thing to do when transitioning a site to HTTPS, for example, to root out any mixed content warnings. In this article, we’ll implement this feature via a small WordPress plugin. What is mixed content? “Mixed content” means you’re loading a page over HTTPS page, but some of the assets on that page (images, videos, CSS, scripts, scripts called by scripts, etc) are loaded via plain...

Read More

Robust React User Interfaces with Finite State Machines

User interfaces can be expressed by two things: The state of the UI Actions that can change that state From credit card payment devices and gas pump screens to the software that your company creates, user interfaces react to the actions of the user and other sources and change their state accordingly. This concept isn’t just limited to technology, it’s a fundamental part of how everything works: For every action, there is an equal and opposite reaction. – Isaac Newton This is a concept we can apply to developing better user interfaces, but before we go there, I want...

Read More

Grid areas and the element that occupies them aren’t necessarily the same size.

That’s a good little thing to know about CSS grid. I’m sure that is obvious to many of you, but I’m writing this because it was very much not obvious to me for far too long. Let’s take a close look. There are two players to get into your mind here: The grid area, as created by the parent element with display: grid; The element itself, like a , that goes into that grid area. For example, say we set up a mega simple grid like this: .grid { display: grid; grid-template-columns: 1fr 1fr; grid-gap: 1rem; } If we...

Read More

CSS Code Smells

Every week(ish) we publish the newsletter which contains the best links, tips, and tricks about web design and development. At the end, we typically write about something we’ve learned in the week. That might not be directly related to CSS or front-end development at all, but they’re a lot of fun to share. Here’s an example of one those segments from the newsletter where I ramble on about code quality and dive into what I think should be considered a code smell when it comes to the CSS language. A lot of developers complain about CSS. The cascade! The weird property names! Vertical alignment! There are many strange things about the language, especially if you’re more familiar with a programming language like JavaScript or Ruby. However, I think the real problem with the CSS language is that it’s simple but not easy. What I mean by that is that it doesn’t take much time to learn how to write CSS but it takes extraordinary effort to write “good” CSS. Within a week or two, you can probably memorize all the properties and values and make really beautiful designs in the browser without any plugins or dependencies and wow all you’re friends. But that’s not what I mean by “good CSS.” In an effort to define what that is I’ve been thinking a lot lately about how we can identify...

Read More
www.000webhost.com