Style legend

There’s a new proposal for giving developers more control over styling form controls. I like it.

It’s clearly based on the fantastic work being done by the Open UI group on the select element. The proposal suggests that authors can opt-in to the new styling possibilities by declaring:

appearance: base;

So basically the developer is saying “I know what I’m doing—I’m taking the controls.” But browsers can continue to ship their default form styles. No existing content will break.

The idea is that once the developer has opted in, they can then style a number of pseudo-elements.

This proposal would apply to pretty much all the form controls you can think of: all the input types, along with select, progress, meter, buttons and more.

But there’s one element more that I wish were on the list:

legend

I know, technically it’s not a form control but legend and fieldset are only ever used within forms.

The legend element is notoriously annoying to style. So a lot of people just don’t bother using it, which is a real shame. It’s like we’re punishing people for doing the right thing.

Wouldn’t it be great if you, as a developer, had the option of saying “I know what I’m doing—I’m taking the controls”:

legend {
  appearance: base;
}

Imagine if that nuked the browser’s weird default styles, effectively turning the element into a span or div as far as styling is concerned. Then you could style it however you wanted. But crucially, if browsers shipped this, no existing content would break.

The shitty styling situation for legend (and its parent fieldset) is one of those long-standing annoyances that seems to have fallen down the back of the sofa of browser vendors. No one’s going to spend time working on it when there are more important newer features to ship. That’s why I’d love to see it sneak in to this new proposal for styling form controls.

I was in Amsterdam last week. Just like last year I was there to help out Vasilis’s students with a form-based assignment:

They’re given a PDF inheritance-tax form and told to convert it for the web.

Yes, all the excitement of taxes combined with the thrilling world of web forms.

(Side note: this time they were told to style it using the design system from the Dutch railway because the tax office was getting worried that they were making phishing sites.)

I saw a lot of the same challenges again. I saw how students wished they could specify a past date or a future date in a date picker without using JavaScript. And I saw them lamenting the time they spent styling legends that worked across all browsers.

Right now, Mason Freed has an open issue on the new proposal with his suggestion to add some more elements to consider. Both legend and fieldset are included. That gets a thumbs-up from me.

Have you published a response to this? :

Responses

Nicol Wistreich

@adactio yes to legend controls.. “The shitty styling situation for legend (and its parent fieldset) is one of those long-standing annoyances that seems to have fallen down the back of the sofa of browser vendors.” 💯

5 Shares

# Shared by James Buckley on Wednesday, March 19th, 2025 at 2:42pm

# Shared by Dan Ryan :dryan: on Wednesday, March 19th, 2025 at 8:13pm

# Shared by Duncan Lock on Thursday, March 20th, 2025 at 12:21am

# Shared by Thomas Beduneau on Saturday, March 22nd, 2025 at 7:08am

# Shared by Nicol Wistreich on Saturday, March 22nd, 2025 at 1:40pm

10 Likes

# Liked by James Buckley on Wednesday, March 19th, 2025 at 2:42pm

# Liked by Francesco on Wednesday, March 19th, 2025 at 2:42pm

# Liked by Krijn Hoetmer on Wednesday, March 19th, 2025 at 4:36pm

# Liked by Simon St.Laurent on Saturday, March 22nd, 2025 at 12:03am

# Liked by Jen Simmons on Saturday, March 22nd, 2025 at 12:03am

# Liked by Jared “Indie Social Web” White on Saturday, March 22nd, 2025 at 6:08am

# Liked by Johannes Odland on Saturday, March 22nd, 2025 at 6:33am

# Liked by Thomas Beduneau on Saturday, March 22nd, 2025 at 7:08am

# Liked by Luke on Saturday, March 22nd, 2025 at 9:38am

# Liked by tambourineman on Sunday, March 23rd, 2025 at 1:07am

Related posts

Progressive disclosure defaults

If you’re going to toggle the display of content with CSS, make sure the more complex selector does the hiding, not the showing.

Making the Patterns Day website

The joy of getting hands-on with HTML and CSS.

Supporting logical properties

Using the CSS trinity of feature queries, logical properties, and unset.

Faulty logic

CSS logical properties here, they just aren’t evenly distributed yet.

Drag’n’drop revisited

An easy accessibility fix, courtesy of my past self.

Related links

The Great CSS Expansion | Butler’s Log

Web development follows a familiar cycle. First we glue together a solution with whatever we have — JavaScript, image hacks, Flash, anything. Then the platform matures, and CSS or HTML eventually makes that same workaround native. Rounded corners, custom fonts, smooth scrolling, sticky positioning: all of these started as JavaScript-heavy hacks before CSS turned them into a single declaration.

We are in another one of those transition moments. A new wave of long-requested CSS features is finally landing, and many of them are explicitly designed to replace patterns that used to require JavaScript. Not as approximations — as first-class platform primitives that handle the edge cases, run in the right thread, and need zero dependencies.

Tagged with

An in-depth guide to customising lists with CSS - Piccalilli

Think you know about styling lists with CSS? Think again!

This is just a taste of the kind of in-depth knowledge that Rich will be beaming directly into our brains at Web Day Out

Tagged with

What’s new in web typography? | Clagnut by Richard Rutter

There have been so many advances in HTML, CSS and browser support over the past few years. These are enabling phenomenal creativity and refinement in web typography, and I’ve got a mere 28 minutes to tell you all about it.

I’ve been talking to Rich about his Web Day Out talk, and let me tell you, you don’t want to miss it!

It’s gonna be a wild ride! Join me at Web Day Out in Brighton on 12 March 2026. Use JOIN_RICH to get 10% off and you’ll also get a free online ticket for State of the Browser.

Tagged with

NoLoJS: Reducing the JS Workload with HTML and CSS - Web Performance Calendar

You might not need (much) JavaScript for these common interface patterns.

While we all love the power and flexibility JS provides, we should also respect it, and our users, by limiting its use to only what it needs to do.

Yes! Client-side JavaScript should do what only client-side JavaScript can do.

Tagged with

Write Code That Runs in the Browser, or Write Code the Browser Runs - Jim Nielsen’s Blog

So instead of asking yourself, “How can I write code that does what I want?” Consider asking yourself, “Can I write code that ties together things the browser already does to accomplish what I want (or close enough to it)?”

Tagged with

Previously on this day

2 years ago I wrote What the world needs

Write for yourself.

2 years ago I wrote Schooltijd

Going back to school in Amsterdam.

6 years ago I wrote Nice

The meaning of life.

13 years ago I wrote Placehold on tight

Getting consistent browser behaviour for the placeholder attribute.

14 years ago I wrote Of Time and the Network and the Long Bet

Matt has accepted the challenge I threw down in my Webstock talk (which has now been transcribed).

19 years ago I wrote Twitter… again

Even if you don’t like it, let us have our fun.

21 years ago I wrote Split personality

I realised something while I was at South by SouthWest: I’m an online introvert.

23 years ago I wrote Uncle Alan

Alan Keith OBE passed away yesterday.