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

But that doesn't magically insert comments explaining the reasoning behind doing a certain thing a certain way. I don't know about you, but I have those comments in my CSS just for myself, which is a good indicator a newbie might have use for them as well. Lucky for me I do parsing/compacting/caching the CSS on the fly, so I might as well put a comment into the compact version explaining where to get the "max" version. But I don't see how it would be much work with static files for that matter.



I have comments in my css too, mostly things like "product grid", "product detail" etc, which only really function as things to navigate with by searching.

Expecting comments in css to act as some sort of tutorial is a dead end, any website will involve html/css/js working in tandem, why put them in css, rather than html, or js?

A better format for this would be a number of good old fashioned tutorials, screencasts etc geared toward providing the mental tools to inspect any website.

So, sure it wouldn't be much work to add in a comment pointing to an unminified css file, but i fear it would be of little utility to someone learning. That is ignoring the fact i often have 20+ css files across a large site (minified compiled and combined before serving), similar number of js resources and who knows how many combinations of html templates...


What sort of comments do you add? Mine are usually of two varieties - either explaining a pixel value (width + border + margin), or adding a short note about why I did something unconventional (two pixels removed so FireFox doesn't flow to the next line). In either case, someone learning CSS wouldn't be hugely benefitted by them, since I don't make the comments all that verbose.

That said, I usually don't minify my CSS anyway. I was just wondering if there are any significant cases where comments would make a huge difference to someone who is learning CSS.


I think the latter is what could be useful to people learning. E.g. "set X to Y so browser B doesn't do Z" is actually useful to someone who has never seen that behaviour and may encounter it, or be looking at you sources cause it seems you handled it somehow but it doesn't work on one's own page.

Not sure how much though.




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

Search: