<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/our-css-isn-t-opinionated-enough-6dn7uw14p" -->

---
title: Our CSS isn’t opinionated enough | daily.dev
description: Craig Abbott argues that the long-standing CSS best practice of styling exclusively with classes has trained developers to decouple visual appearance from...
canonical: https://daily.dev/posts/our-css-isn-t-opinionated-enough-6dn7uw14p
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Our CSS isn’t opinionated enough | daily.dev
og:description: Craig Abbott argues that the long-standing CSS best practice of styling exclusively with classes has trained developers to decouple visual appearance from...
og:url: https://daily.dev/posts/our-css-isn-t-opinionated-enough-6dn7uw14p
og:image: https://api.daily.dev/og/posts/6dN7UW14p.png
og:image:alt: Our CSS isn’t opinionated enough
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Our CSS isn’t opinionated enough

**[Craig Abbott](https://daily.dev/sources/craigabbott)** · 10 min read · 0 upvotes · 0 comments

## Summary

Craig Abbott argues that the long-standing CSS best practice of styling exclusively with classes has trained developers to decouple visual appearance from semantic meaning, making accessibility easy to skip. He shows how a div or span can be styled to look like a button but lacks keyboard operability, correct ARIA role, and screen reader support, failing WCAG 4.1.2 and 2.1.1. He proposes styling directly on tag selectors (like button) and on ARIA state attributes (like aria-current, aria-expanded, aria-invalid, aria-pressed) so that visual styling cannot exist without the underlying semantics being correct. He acknowledges limitations: role="button" on a div still needs manual behavior, utility-first frameworks like Tailwind don't fit this model well, tag selectors can be too broad without a variant plan, and ARIA-attribute styling only works if JavaScript actually updates those attributes.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.craigabbott.co.uk/blog/2026/our-css-isnt-opinionated-enough>

## Questions this post answers

### Why is styling a div with a button class not accessible even if it looks like a button?

A div styled to look like a button is purely cosmetic and carries none of the native button behavior. Only an actual button element is focusable by keyboard, fires on Enter and Space keys, is announced as a button by screen readers, and responds to voice commands like "click button." A styled div fails WCAG 4.1.2 Name, Role, Value and often 2.1.1 Keyboard because the role isn't communicated and it can't be operated without a mouse.

_Teams weighing class-based versus semantic CSS approaches can track these accessibility debates on daily.dev._

### How can I make sure my CSS styling reflects ARIA state like aria-expanded or aria-current instead of just a class?

Attach the visual style directly to the ARIA attribute selector rather than a separate class, for example styling a.nav__link[aria-current="page"] instead of a .nav__link--current class, or targeting [aria-expanded="true"] and [aria-invalid="true"]. Attribute selectors carry the same specificity as a class, so the visible state can only appear when the semantic state is actually set, preventing the two from becoming decoupled.

_Developers building accessible components can follow ongoing CSS and ARIA best-practice discussions on daily.dev._

### What are the downsides of styling CSS based on ARIA attributes and tag selectors instead of classes?

It doesn't fully solve accessibility on its own: adding role="button" to a div still requires manually coding tabindex and event handlers to make it behave like a real button. It clashes with utility-first frameworks like TailwindCSS, which rely on chaining classes rather than styling tags or ARIA attributes. Tag selectors can also become too broad without a variant strategy, and ARIA-based styles only work correctly if JavaScript actually updates those attributes.

_Anyone weighing utility-first CSS against semantic styling can follow the trade-offs on daily.dev._

## Similar posts on daily.dev

- [I Learned The First Rule of ARIA the Hard Way](https://daily.dev/posts/i-learned-the-first-rule-of-aria-the-hard-way-bf3esumgq) · CSS-Tricks · 210 upvotes · 12 comments
- [Building Better Buttons](https://daily.dev/posts/building-better-buttons-kfg2u6xfq) · Simple Thread · 68 upvotes · 5 comments
- [What AI Gets Wrong About the Front End, and Why You Still Need to Know](https://daily.dev/posts/what-ai-gets-wrong-about-the-front-end-and-why-you-still-need-to-know-rpluifzzr) · SitePoint · 1 upvotes · 1 comments
- [If you want to create a button from scratch, you must first create the universe](https://daily.dev/posts/if-you-want-to-create-a-button-from-scratch-you-must-first-create-the-universe-81uyduuo1) · Hacker News · 2 upvotes · 1 comments
- [Chris’ Corner: A11Y](https://daily.dev/posts/chris-corner-a11y-uqdhzm4a9) · CodePen · 0 upvotes · 0 comments

---

Tags: [#css](https://daily.dev/tags/css), [#html](https://daily.dev/tags/html), [#accessibility](https://daily.dev/tags/accessibility)

[View this post on daily.dev](https://daily.dev/posts/our-css-isn-t-opinionated-enough-6dn7uw14p)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Our CSS isn’t opinionated enough","url":"https://daily.dev/posts/our-css-isn-t-opinionated-enough-6dn7uw14p","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/our-css-isn-t-opinionated-enough-6dn7uw14p"},"datePublished":"2026-09-20T07:43:59.692Z","dateModified":"2026-09-20T07:45:39.808Z","description":"Craig Abbott argues that the long-standing CSS best practice of styling exclusively with classes has trained developers to decouple visual appearance from...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/a0ffc407e6f6c1b75eadc5a3e5dc0325?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/a0ffc407e6f6c1b75eadc5a3e5dc0325?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Craig Abbott","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Craig Abbott","logo":"https://media.daily.dev/image/upload/s--7L_KxzEH--/f_auto,q_auto/v1789890198/logos/craigabbott?_a=BAMAMicg0","url":"https://daily.dev/sources/craigabbott"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/our-css-isn-t-opinionated-enough-6dn7uw14p","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"css,html,accessibility","timeRequired":"PT10M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Craig Abbott","item":"https://daily.dev/sources/craigabbott"},{"@type":"ListItem","position":3,"name":"Our CSS isn’t opinionated enough"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/our-css-isn-t-opinionated-enough-6dn7uw14p#faq","mainEntity":[{"@type":"Question","name":"Why is styling a div with a button class not accessible even if it looks like a button?","acceptedAnswer":{"@type":"Answer","text":"A div styled to look like a button is purely cosmetic and carries none of the native button behavior. Only an actual button element is focusable by keyboard, fires on Enter and Space keys, is announced as a button by screen readers, and responds to voice commands like \"click button.\" A styled div fails WCAG 4.1.2 Name, Role, Value and often 2.1.1 Keyboard because the role isn't communicated and it can't be operated without a mouse. Teams weighing class-based versus semantic CSS approaches can track these accessibility debates on daily.dev."}},{"@type":"Question","name":"How can I make sure my CSS styling reflects ARIA state like aria-expanded or aria-current instead of just a class?","acceptedAnswer":{"@type":"Answer","text":"Attach the visual style directly to the ARIA attribute selector rather than a separate class, for example styling a.nav__link[aria-current=\"page\"] instead of a .nav__link--current class, or targeting [aria-expanded=\"true\"] and [aria-invalid=\"true\"]. Attribute selectors carry the same specificity as a class, so the visible state can only appear when the semantic state is actually set, preventing the two from becoming decoupled. Developers building accessible components can follow ongoing CSS and ARIA best-practice discussions on daily.dev."}},{"@type":"Question","name":"What are the downsides of styling CSS based on ARIA attributes and tag selectors instead of classes?","acceptedAnswer":{"@type":"Answer","text":"It doesn't fully solve accessibility on its own: adding role=\"button\" to a div still requires manually coding tabindex and event handlers to make it behave like a real button. It clashes with utility-first frameworks like TailwindCSS, which rely on chaining classes rather than styling tags or ARIA attributes. Tag selectors can also become too broad without a variant strategy, and ARIA-based styles only work correctly if JavaScript actually updates those attributes. Anyone weighing utility-first CSS against semantic styling can follow the trade-offs on daily.dev."}}]}
```

