Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

While undoubtedly impressive, I think using css :before and :after kind of defeats the point of 'single element'


No it doesn't really, it keeps your HTML clean. Sure, there's better ways of getting a MacBook into your webpage, but this definitely shows the power of the :before and :after selectors.


It may keep your HTML clean, but it makes your CSS messy!


That's why I said there's better ways of getting a MacBook into your webpage. But my point still stands, :before and :after are very powerful.


I'd much rather have clean, reusable HTML. CSS you can use preprocessors to abstract away the messiness.


Aren't you using templates and macros for HTML already?


Changing how the HTML macros expand likely ends up requiring CSS changes (in practice, though not necessarily in a theoretically-ideal code base). One change in two places, vs one change in one place.


No, I typically write entirely client side applications.


Any reading recommendations for someone who isn't?


> No it doesn't really, it keeps your HTML clean.

You can also keep your kitchen clean by stuffing all the dirty stuff into the cupboards.


The thing to keep in mind is that the use of pseudo-elements keeps the style separate from the content. In terms of practicality, there isn't much; I did this as an experiment in semantics and the latest CSS properties and techniques.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: