Hacker News new | ask | show | jobs
by wtf_srsly 2136 days ago
> You can do these things in JavaScript: match your media queries in JavaScript and change the inline styles, and reimplement :hover, :focus and the likes. But I expect (without supporting measurements) that doing this for everything will be fairly bad for performance, and it will generally be less responsive (in the performance sense of the word rather than the resolution-independence sense of the word), e.g. your state-dependent styles may apply a frame later than they should.

It's also fairly bad practice to put your CSS into JavaScript for a number of reasons (such as accessibility, disabled javascript etc.).

1 comments

> It's also fairly bad practice to put your CSS into JavaScript for a number of reasons (such as accessibility

Could you explain why it would affect accessibility?