Tags: CSS
1210
Tuesday, March 21st, 2023
The perfect link - The A11Y Collective
How do we write, design, and code a link that works for everyone on every device? Let’s dive into the world of creating the perfect link, without making a pig’s breakfast of it.
Preventing too-short final lines of blocks | Clagnut by Richard Rutter
Check out the demo that Rich has put together to go with Amelia’s proposed syntax.
Thursday, March 16th, 2023
Modern Font Stacks
This is handy—a collection of font stacks using system fonts. You can see which ones are currently installed on your machine too.
The most performant web font is no web font.
Wednesday, March 15th, 2023
print-color-adjust - CSS: Cascading Style Sheets | MDN
I love print stylesheets but I was today years old when I found out that print-color-adjust
exists.
Tuesday, March 14th, 2023
Why aren’t logical properties taking over everything? - Chris Coyier
Good question.
I think it’s mostly inertia.
Thursday, March 9th, 2023
Some simple ways to make content look good - Set Studio
This is a terrific walkthrough from Andy showing how smart fundamentals in your CSS can give you a beautiful readable document without much work.
Wednesday, March 8th, 2023
An end to typographic widows on the web | Clagnut by Richard Rutter
Rich explains what text-wrap:balance
does …and what it doesn’t.
Monday, March 6th, 2023
The Web Needs a Native .visually-hidden
I agree with the reasoning here—a new display
value would be ideal.
Thursday, March 2nd, 2023
Jeremy Keith – Declarative Design – SOTR - YouTube
Here’s the video of the talk I gave at Monday’s meet-up here in Brighton—it’s a very condensed version of my longer conference talk on declarative design.
Wednesday, March 1st, 2023
On Container Queries, Responsive Images, and JPEG-XL – Cloud Four
Container queries can’t be used in the sizes
attribute for responsive images. Here, Jason breaks down why that is (spoiler: it’s the lookahead pre-parser) and segues into a truly long term solution: a “magical” image format.
If you’ve ever thought it felt weird to put media conditions inside the HTML for responsive images, this will resonate.
Friday, February 10th, 2023
The Guide To Responsive Design In 2023 and Beyond - Ahmad Shadeed
Instead of thinking about responsive design in terms of media queries, I like to think of responsive design in these categories.
- Responsive to the content
- Responsive to the viewport
- Responsive to the container
- Responsive to the user preferences
Saturday, January 28th, 2023
Container Queries and Typography
I feel like we need a name for this era, when CSS started getting real good.
I think this is what I’ve been calling declarative design.
Sunday, January 22nd, 2023
clamp() Calculator · Chris Burnell
Like a little mini Utopia:
Handy little tool for calculating viewport-based clamped values.
Culture and style
Ever get the urge to style a good document?
No? Just me, then.
Well, the urge came over me recently so I started styling this single-page site:
A Few Notes On The Culture by Iain M Banks
I’ve followed this document across multiple locations over the years. It started life as a newsgroup post on rec.arts.sf.written in 1994. Ken McLeod published it there on Iain M Banks’s behalf.
The post complements the epic series of space opera books that Iain M Banks set in the anarcho-utopian society of The Culture. It’s a fascinating piece of world building, as well as an insight into the author’s mind.
I first became aware of it many few years later, after a copy had been posted to the web. That URL died, but Adrian Hon kept a copy on his site. Lots of copies keep stuff safe, so after contemplating linkrot, I made a copy on this site too.
But I recently thought that maybe it deserved a bit of art direction, so I rolled up my sleeves and started messing around, designing in the browser and following happy little accidents.
The finished result is still fairly sparse. It’s still entirely text, except for a background image that shows up if your screen is wide enough. That image of a planet originally started as an infra-red snapshot of Jupiter by the James Webb Space Telescope that I worked over until it was unrecognisable.
The text itself is the main focus of the design though. I knew I wanted to play around with a variable font. Mona Sans from Github was one of the first ones I tried and I found it instantly suitable. I had a lot of fun playing with different weights and widths.
After a bit of messing around, I realised that the heading styles were reminding me of some later reissues of The Culture novels, so I leant into that, deliberately styling the byline to resemble the treatment of the author’s name on those book covers.
There isn’t all that much CSS. I’ve embedded it in the head of the HTML rather than linking to a separate style sheet, so feel free to view source and poke around in there. You’ll see that I’m making liberal use of custom properties, the clamp function, and logical properties.
Originally I had a light mode and dark mode but I found that the dark mode was much more effective so I ditched the lighter option.
I did make sure to include some judicious styles for print, so if you fancy reading on paper, it should print out nicely.
Oh, and of course it’s a progressive web app that works offline.
I didn’t want to mess with the original document other than making some typographic tweaks to punctuation, but I wanted to break up the single wall of text. I wasn’t about to start using pull quotes on the web so in the end I decided to introduce some headings that weren’t in the original document:
- Government
- Economics
- Technology
- Philosophy
- Lifestyle
- Travel
- Habitat
- Legal System
- Politics
- Identity
- Nomenclature
- Cosmology
If your browser viewport is tall enough, the heading for the current section you’re reading will remain sticky as you scroll. No JavaScript required.
I’m pretty pleased with how this little project turned out. It was certainly fun to experiment with fluid type and a nice variable font.
I can add this to my little collection of single-page websites I’ve whittled over the years:
Tuesday, January 17th, 2023
Patrick / articles / Is the developer experience on the Web so terrible?
Over the past 10 years or so, we’ve slowly but very surely transitioned to a state where frameworks are the norm, and I think it’s a problem.
I concur.
Use the frameworks and libraries that make sense for you to deliver the best UX possible. But also learn the web platform from the ground up. Take time to understand how web browsers work and render webpages. Learn HTML, CSS, JavaScript. And keep an eye, if you can, on the new things.
Henry From Online | How To Make a Website
Write meaningful HTML that communicates the structure of your document before any style or additional interactivity has loaded. Write CSS carefully, reason your methodology and stick to it, and feel empowered to skip frameworks. When it comes time to write JavaScript, write not too much, make sure you know what it all does, and above all, make sure the website works without it.
The whole article is great, and really charmingly written, with some golden nuggets embedded within, like:
- You’ll find that spending more time getting HTML right reveals or even anticipates and evades accessibility issues. It’s just easier to write accessible code if it’s got semantic foundations.
- In my experience, you will almost always spend more time overriding frameworks or compromising your design to fit the opinions of a framework.
- Always style from the absolute smallest screen your content will be rendered on first, and use
@media (min-width)
queries to break to layouts that allow for more real estate as it becomes available.- If your site doesn’t work without JavaScript, your site doesn’t work.
- Always progressively enhance your apps, especially when you’re fucking with something as browser-critical as page routing.
CSS { In Real Life } | Disentangling Frameworks
I think some tools are a good idea. But as few as possible, and the easier they are to stop using, the better.
Now Michelle asks:
Suppose we want to stop using Tailwind one day?
Turns out it’s a bit of a roach motel, much like most JavaScript frameworks: you can get in but you can’t easily get out.
So whenever possible, the safest, and most future-proof bet is to use the native features of the web platform.
Scalable CSS - Chris Coyier
Wise words:
Myself, I think some tools are a good idea. But as few as possible, and the easier they are to stop using, the better.
To paraphrase Michael Pollan:
Write CSS, not too much, mostly vanilla.
Monday, January 16th, 2023
Line heights in CSS work better with ratios | Andy Bell
There’s a broader point here about declarative design:
Setting very specific values may feel like you’re in more control, but you’re actually rescinding control by introducing fragility in the form of overly-specific CSS.