TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: What do you think of the anti-CSS debate?

10 pointsby donjhalmost 10 years ago
I've been hearing more and more about the concept of applying inline styles through JavaScript as opposed to using CSS. There's been an article floating around regarding the idea, too (https://css-tricks.com/the-debate-around-do-we-even-need-css-anymore/). What's your take?

7 comments

pixellabalmost 10 years ago
As someone who writes CSS frameworks for a living, I don't know if I could ever give up the powerful globalness of the "c" (cascading.) Though, I do find myself writing more and more inline styles for elements that are specific to a block or page to avoid bloating the framework. I'm thinking a blended approach is in my future.
bjournealmost 10 years ago
I think he is glossing over CSS main selling point which is a separation of concerns. Essentially, you can code a web-site unstyled and then let an independent 3rd party write a style sheet for it.<p>He is saying that you would have a &#x27;style.js&#x27; performing the task, but he is not specifying exactly how that file would replace the &#x27;style.css&#x27;. A designer writing the &#x27;style.js&#x27; key-value pair seems implausible as does converting a designer-created &#x27;style.css&#x27; to &#x27;style.js&#x27;.
jdeisenbergalmost 10 years ago
Random thoughts: As far as I understand it, CSS is declarative. JavaScript, not so much. The declarative aspect of CSS is nice; you just specify what you want and CSS handles everything else for you.<p>I am also idly wondering how this would all work out in &quot;HTML and CSS as s-expressions&quot; à la Ŝablono <a href="https:&#x2F;&#x2F;github.com&#x2F;r0man&#x2F;sablono" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;r0man&#x2F;sablono</a>
seanekingalmost 10 years ago
To me this is a bit of a &#x27;baby with the bathwater&#x27; scenario. CSS has problems (particularly lack of namespacing), but I don&#x27;t think the solution is to just pack up shop on stylesheets and port everything to js. If the argument is about logic, then postCSS and manipulating the CSSOM are cleaner approaches IMO. And with web components the modularity concern is pretty much entirely mitigated. There&#x27;s definitely an argument to be made about javascript&#x27;s role styling, but I think it should be complimentary alongside the purely declarative stylesheet.
n17r4malmost 10 years ago
Personally, I think there is a lot of magic yet to be discovered in dynamically manipulating the CSSOM (CSS Object Model).<p>Case study: If trying to manipulate some ~100 inline-block elements into a grid, with dynamic (say, zoomable + pannable + screen size dependant) width, height and offset. It makes way more sense to programmatically modify the stylesheet using the CSSOM API with fast calculated values, rather than applying unique styles to each of those 100 elements in the DOM, O(1) vs O(n) - yes?
vezzy-fnordalmost 10 years ago
Ironically enough, Netscape proposed a JavaScript Style Sheets specification back in 1996 to replace CSS, but was rejected for being too complicated: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;JavaScript_Style_Sheets" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;JavaScript_Style_Sheets</a>
helpmeimpooralmost 10 years ago
I hope html and css bending become one language is there any language like that to make a webpage?
评论 #9797292 未加载