Hacker News new | past | comments | ask | show | jobs | submit login

Your example here is actually a perfect reason.

Inline styles apply all of the time. With a class, you have access to media queries and thus some basic form of logic.

The “md:” prefix is used exactly for this. It applies any following class at a medium media query breakpoint. Same thing with focus or hover styles, also impossible with an inline style attribute.

The custom overrides are obviously more one off and less reusable, so the difference between those and a style attribute are less obvious at first glance. With classes though, you are bound to the class names in your stylesheet and thus some form of sanitization/linting. Inline styles won’t stop you from breaking your design system.




Got it, makes sense, thanks.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: