Search
A Grid of Logos in Squares
6.4.2020
Let’s build a literal grid of squares, and we’ll put the logos of some magazines centered inside each square. I imagine plenty of you have had to build a logo grid before. You can probably already picture it: an area of a site that lists the donors, sponsors, or that is showing off...
Fluid Width Video
11.3.2020
IN A WORLD of responsive and fluid layouts on the web, ONE MEDIA TYPE stands in the way of perfect harmony: video. There are lots of ways in which video can be displayed on your site. You might be self-hosting the video and presenting it via the HTML5 <video tag. You might...
Currying in CSS
6.3.2020
Funny timing on this I was just looking at the website for Utopia (which is a responsive type project which I hate to admit I don't fully understand) and I came across some CSS they show off that looked like this:
:root {
--fluid-max-negative: (1 / var(--fluid-max-ratio)...
Do This to Improve Image Loading on Your Website
20.2.2020
Jen Simmons explains how to improve image loading by simply 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. Then it needs...
Centering a div That Maintains Aspect-Ratio When There’s Body Margin
18.2.2020
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...
BTC’s Market Share Drops Consecutively for 14 Days – Dominance Ratio Slides to 60%
15.2.2020
Cryptocurrency markets have been climbing higher in value as coins like BTC have gained over 19% during the last 90 days. However, many other digital assets have seen much larger gains and BTC dominance has been sliding downwards consecutively for the last 14 days. Also Read: Craig Wright’s...
Helping Browsers Optimize With The CSS Contain Property
10.2.2020
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....
Fear Grips Stock Market Traders While Cryptocurrency Investors Become Greedy
4.2.2020
The clash of two emotions, fear and greed, is said to determine investors’ sentiment. This ratio draws a historical picture of the market and it’s also an indicator of its future state. As an established trend, traditional investments such as stocks and digital assets like...
The Controversial S2F Model Predicts Bitcoin Price Will Reach 100,000 USD Within 2 Years
4.2.2020
The current price of BTC is roughly in line with the popular stock-to-flow (S2F) system for technical analysis, and if the trend continues some speculate the price of the asset could reach $100,000 within the next two years. Though the S2F tool is still a controversial metric, and various groups...
Weekly Platform News: Contrast Ratio Range, replaceAll Method, Native File System API
22.11.2019
In this week's roundup: Firefox's new contrast checker, a simpler way to lasso substrings in a string, and a new experimental API that will let apps fiddle with a user's local files.
Firefox shows the contrast ratio range for text on a multicolored background
According to Success Criterion 1.4.3...
Oh Hey, Padding Percentage is Based on the Parent Element’s Width
13.11.2019
I learned something about percentage-based (%) padding today that I had totally wrong in my head! I always thought that percentage padding was based on the element itself. So if an element is 1,000 pixels wide with padding-top: 50%, that padding is 500 pixels. It's weird having top padding based...
German Bank Predicts BTC at $90,000 After Next Halving
3.10.2019
You wouldn’t expect a traditional financial institution to come up with a very optimistic forecast about the future of a cryptocurrency or an honest appraisal of its design. But Bayern LB, a lender based in the rich German province of Bavaria, has surprised the crypto community. In a recently...
Responsive Iframes
25.7.2019
Say you wanted to put the CSS-Tricks website in an <iframe>. You'd do that like this:
<iframe src="https://css-tricks.com"></iframe>
Without any other styling, you'd get a rectangle that is 300x150 pixels in size. That's not even in the User Agent stylesheet, it's just some...
The Fight Against Layout Jank
11.7.2019
A web page isn't locked in stone just because it has rendered visually. Media assets, like images, can come in and cause the layout to shift based on their size, which typically isn't known in fluid layouts until they do render. Or fonts can load and reflow layout. Or XHRs can bring in more content...
How to Use Bitcoin to Invest in Gold
8.6.2019
Gold and bitcoin enjoy a curious relationship. On the one hand, there is a significant crossover between investors in both, particularly from libertarians who don’t trust the U.S. dollar. But on the other hand, initiatives such as #DropGold have sought to position bitcoin as a more portable...
What if we got aspect-ratio sized images by doing almost nothing?
7.6.2019
Say you have an image you're using in an <img> that is 800x600 pixels. Will it actually display as 800px wide on your site? It's very likely that it will not. We tend to put images into flexible container elements, and the image inside is set to width: 100%;. So perhaps that image ends...
Designing An Aspect Ratio Unit For CSS
13.3.2019
Rachel Andrew says that the CSS Working Group designed an aspect ration unit at a recent meeting. The idea is to find an elegant solution to those times when we want the height of an element to be calculated in response to the width of the element, or vice versa.
Say, for example, we have a grid...
How to create a logo that responds to its own aspect ratio
28.6.2018
One of the cool things about <svg> is that it's literally its own document, so @media queries in CSS inside the SVG are based on its viewport rather than the HTML document that likely contains it.
This unique feature has let people play around for years. Tim Kadlec experimented with...