🔥 There are 449 Hot Tips!!

Hot tips are spicy lil' nuggets related to web development and tooling that I share on my twitter account. I've logged them here to make them easier to find.

Here are 10 hot tips for using CSS :has() 👉🏻

1: CSS :has() Basics Select an element based on its children. Handy when you want to style a parent differently when it contains media.

2: The anywhere selector! When The body has a checkbox checked, you can grab literally any other element in the body and style it. Useful for toggling settings without JS.

3: The Previous Element Selector! Grab the item before the selected item. Never before (heh) possible!

4: Layout Targeting! I use this in my slide decks. Based on the contents of the slide, I can create a few commonly used layouts.

Adding or removing elements will automatically change the layout.

  1. Form Validation Styling. Style the label, fieldset or wrapping element based on the validation of the input.

You can pair this with the previous element selector as well if your label and inputs are siblings.

  1. All Siblings! When you are hovering a child, select all the siblings, but not the hovered one. Useful if you want to focus or scale up an element while dimming the rest. Works well table rows too!

  2. Quantity Queries. When a parent has more than 5 children, style it differently.

Perhaps you want to add CSS mask and fade out the rest of the items.

  1. Empty Children Select the parent when it's children are empty.

Maybe you want to show skeleton loaders, or flag an element for debugging?

  1. Nested dropdown navs. Add a ↓ when there is a dropdown available.

  2. Attribute Selectors! Style the parent based on it's child file type!

889722316K
91323K
30
3K571422K299K

auto-growing <textarea> without JavaScript!

CSS is getting field-sizing: content; to size inputs by their contents.

Dropped in Chrome Canary today, demo here:

2K26433766203K
1.2K24
2.5K1635644K
3.1K82K

Suuuper handy new CSS:

:user-invalid and :user-valid pseudo selectors let you style inputs only once they have been interacted with

Just landed in Chrome + Safari, been in Firefox for years.

2.1K35721907177K
2.2K1094240K
4.5K154K

Finally! In VS Code, you can now tear off tabs and open the terminal in a new window.

This dropped in the latest VS Code update, along with native copy + paste files.

6.2K173K
5K21114887K
2K23352271177K

AI Experiment: Ricky from Trailer Park Boys and Tim Cook describe my appearance

WebcamGPT4 VisionEleven labs Custom Voice AI

74627K
553451416K
27718
8157437236118K

AI voice changes gonna be good removing or adding accents?!

87274.4K
22312204640K

Here is how these multi-browser demos are being made. It's not websockets!

2.9K358371.7K508K
1.6K68
2.6K1885545K

Unreal.

This is not the first time I've said that this week.

AI writing Tailwind + JS given a quick sketch

1.5K16846992448K
39824
96133K
9541184026K

🔥 The stale-while-revalidate header is suuuuuuper handy for striking a balance between fast loads and and frequently changed content.

Here I am using it to instantly deliver an OG image that takes ~8s to generate.

1451546125K
1212
21213K
108233.8K

Node.js finally has support for loading .env files! You’ll no longer need the dotenv package

Dropped in 20.6.0

Also supports passing runtime flags like —inspect and —watch

3.4K89K
2.4K1357257K
2.9K87
5.1K819127595543K
1055122