In the video embedded below, Jen Simmons explains how to improve image loading by using width and height attributes. The issue is that there’s a lot of jank when an image is first loaded because an img will naturally have a height of 0 before the image asset has been successfully downloaded by the browser. …
Monica Dinculescu: I don’t want every possible padding and margin and colour and flexbox configuration in the world. I just want the ones that I know I end up using in every project. So here is monica.css: my very own CSS framework, which I copy paste at the beginning of every CSS file and take it …
What should you do when you get a complaint about the color contrast in your web design? It might seem perfectly fine to you because you’re able to read content throughout the site, but to someone else, it might be a totally different experience. How can put yourself in that person’s shoes to improve their …
Ahmad Shadeed covers the idea of a card component that has a fixed set of semantic HTML with some BEMy classes on it. There is a title, author, image, and tags. Then he redesigns the card into five totally different designs without touching any of the HTML just the CSS. If this is an ah-ha …
Andrew Welch had a little CSS challenge the other day to make an ordinary div: • centered vertically + horizontally• scales to fit the viewport w/ a margin around it• maintains an arbitrary aspect ratio• No JS There’s a video in that tweet if it helps you visualize the challenge. I saw Paul Bakaus blogging …
Mezo Istvan does a good job of covering the problem and a solution to it in a blog post on Medium.
If you tap on something that has a :hover state but you don’t leave the page then, on a mobile device, there is a chance that :hover state “sticks.” You’ll see this with stuff like jump-links used as tabs or buttons that trigger on-page functionality.
We’ll get to that, but first, a long-winded introduction. I’m still not in a confident place knowing a good time to use native web components. The templating isn’t particularly robust, so that doesn’t draw me in. There is no state management, and I like having standard ways of handling that. If I’m using another library …
I recently wrote an article explaining how you can create a countdown timer using HTML, CSS and JavaScript. Now, let’s look at how we can make that a reusable component by porting it into Vue using basic features that the framework provides. Why do this at all? Well there are few reasons, but two stand out in particular: Keeping UI in sync with the timer state: If you look …
I’m not sure we’ve gotten much better at this since Tim Kadlec wrote this in 2012: Stop me if you’ve heard this one before. “Responsive design is bad for performance.”“User agent detection is bad. Don’t segment the web.”“Hybrid apps don’t work as well as native apps.”“CSS preprocessors shouldn’t be used because they create bloated CSS.” …
A clever idea from Tom Hicks combining MutationObserver (which can “observe” changes to elements like when their attributes, text, or children change) and the Web Audio API for creating sounds. Plop this code into the console on a page where you’d like to listen to essentially any DOM change to hear it doing stuff.
Since I first chimed in on the CSS4¹ thing, there’s been tons of more discussion on it. I’m going to round up my favorite thoughts from others here. There is an overwhelming amount of talk about this, so I’m going to distill it here down as far as I can, hopefully making it easier to …
The <details> and <summary> elements in HTML are useful for making content toggles for bits of text. By default, you see the <summary> element with a toggle triangle (▶︎) next to it. Click that to expand the rest of the text inside the <details> element. But let’s say you want to be able to click …
One thing that caught my eye on the list of features for Lea Verou’s conic-gradient() polyfill was the last item: Supports double position syntax (two positions for the same color stop, as a shortcut for two consecutive color stops with the same color) Surprisingly, I recently discovered most people aren’t even aware that double position …
Web development is always changing. One trend in particular has become very popular lately, and it fundamentally goes against the conventional wisdom about how a web page should be made. It is exciting for some but frustrating for others, and the reasons for both are difficult to explain. A web page is traditionally made up …
This article is full of a bunch of data from Aggelos Arvanitakis. But lemme just focus on his final bit of advice: Investigate whether a zero-runtime CSS-in-JS library can work for your project. Sometimes we tend to prefer writing CSS in JS for the DX (developer experience) it offers, without a need to have access …
Storyblok is a headless but component-based CMS with a built-in live-preview. You can use it for building fast and reliable websites and power native apps with your favorite technology. Let us start with the basics and what a headless CMS is: A headless content management system is a back-end only content management system (CMS) built from …
In an article with the most clickbaity article ever, Joe Honton does a nice job of talking about the evolving landscape of web development. “Full-stack” perhaps had its day as a useful term, but since front-end development touches so many parts of the stack now, it’s not a particularly useful term. Joe himself did a …
Hot news from Brian Kardell, regarding what we’ve been referring to as “container queries,” the most hotly requested feature in CSS: There does seem to be some general agreement on at least one part of what I am going to call instead “Responsive Design for Components” and that is that flipping the problem on its …
Sometimes, we have to go a little further than HTML, CSS, and JavaScript to create the UI we need, and instead use other resources, like SVG, WebGL, canvas, and others. For example, the most amazing effects can be created with WebGL, because it’s a JavaScript API designed to render interactive 2D and 3D graphics within any compatible web browser, allowing GPU-accelerated image …
I was sort of making fun of neumorphism the other day. I don’t actually care that much. I mostly just think it only works on some flat colored backgrounds, mostly really light colors, and somehow that feels weirdly limiting. (nope, sure, sure, nope 🤷♂️). Anyway, I think this “generator” from Adam Giebl (Adam Gieblio maybe?) …
React Router 5 embraces the power of hooks and has introduced four different hooks to help with routing. You will find this article useful if you are looking for a quick primer on the new patterns of React Router. But before we look at hooks, we will start off with a new route rendering pattern.
Say you have an RSS feed like this one. The goal is to request that RSS feed, parse it, and do something useful with the data in it. RSS is XML, and XML is arguably not as easy to work with than JSON. While a lot of APIs offer JSON responses, it’s less typical for …
Wait what? That’s right, direct access to the files and data storage that power your site on WordPress.com, just like you have if you self-host a WordPress site. You can read their announcement here. Note this is for Business and eCommerce plans only.
It was fun watching a bunch of back and forth blogging between a bunch of smart people quoting a bunch of smart people last week. If you missed it, you might wanna start at the end and work backward. I only have one tidbit to add. I don’t do much with design systems. I work …
On the Microsoft Edge team, we’re committed to an open web and helping to drive innovation forward, which is why we’ve kicked off a new initiative in collaboration with Google, Mozilla, Samsung Internet, Igalia and — most importantly — the web community, called The Web We Want. The Web We Want is an open initiative for web developers and …
Back in 2011, the domain name for this site, css-tricks.com, was stolen. “Domain Hijacking,” they call it. It wasn’t just this site, but around 12 others in the design and development space. To this day, none of us really know how it happened and who was behind it, although I believe all the domains are …
There is a growing number of things that we have to do to help the browser achieve for peak performance. Responsive image syntax has several. For example, needing to tell the browser how large the image will be in our layout with the sizes attribute and how big the images are with w descriptors. Regular …