News for hackers. Stuff that matters.
Re:CSS Vocabulary by pamelafox on Thursday April 17, 2014 @04:08AM (#7602480)
Awesome! Just tweeted this out for our GirlDevelopIt students, this is a great review resource.

For those of you looking for alternative ways to learn CSS (or teach it), here are our materials:

* CSS Basics/Layout: http://www.teaching-materials.org/htmlcss-1day/ (Scroll down) * CSS3: https://dl.dropboxusercontent.com/u/10998095/css3-workshop/i...

...I find that teaching the CSS3 workshop is always a great reminder of the crazy ass selectors you can use in CSS now, and I end up using them way more in the weeks after. And then forgetting again. :-)

Re:CSS Vocabulary by indubitably on Thursday April 17, 2014 @06:43PM (#7606985)
This is awesome.
Re:CSS Vocabulary by zatkin on Wednesday April 16, 2014 @10:09PM (#7601669)
This is really neat. I've been using CSS for several years and have never stumbled upon something that uniquely educates in this manner. You'll only really grasp a true understanding of CSS like this if you sift through a lot of (dull) specification.

Also, this brings a lot of attention to the fact that CSS relies upon formal grammar and vocabulary (as the page is titled), which is something that you won't see often.

Re:CSS Vocabulary by Swizec on Wednesday April 16, 2014 @10:21PM (#7601707)
What do you mean exhibit their own idea of grammar? All programming languages are defined in terms of their formal grammar. A grammar and vocabulary is really all that they are.
Re:CSS Vocabulary by zatkin on Wednesday April 16, 2014 @10:57PM (#7601815)
Sorry, I edited my post to clarify.
Re:CSS Vocabulary by reubenmorais on Thursday April 17, 2014 @12:24AM (#7601990)
>You'll only really grasp a true understanding of CSS like this if you sift through a lot of (dull) specification.

You'll likely only need this "true understanding" if you're editing said specification. Or implementing it.

Re:CSS Vocabulary by dredmorbius on Thursday April 17, 2014 @01:24AM (#7602110)
Not really.

I've spent a lot of time in the past year mucking with CSS, some my own, but most of it applying to other sites via browser extensions. I'd learned most of the specific spec entities described here (though learned a few terms I'd not picked out before), some of which have proven quite useful in getting the results I want. Which often translate to "make the goddamned page readable".

And yes, I restyled the referenced page to improve readability (text to white, larger fonts, different spacing and padding).

Re:CSS Vocabulary by sakamies on Thursday April 17, 2014 @03:07AM (#7602324)
Would you mind adding an issue about improving readability at github, or even better, making a fork and adding the improved styling? https://github.com/sakamies/css-vocabulary/issues
Re:CSS Vocabulary by dredmorbius on Thursday April 17, 2014 @04:02AM (#7602462)
Re:CSS Vocabulary by rmmw on Thursday April 17, 2014 @12:52AM (#7602044)
This is great! To anyone else delving into CSS, I also found this tutorial on CSS selectors helpful: http://flukeout.github.io/
Re:CSS Vocabulary by voltagex_ on Wednesday April 16, 2014 @09:37PM (#7601580)
This is a neat and simple idea. I wonder how difficult it would be to add other languages.
Re:CSS Vocabulary by harlanji on Wednesday April 16, 2014 @10:53PM (#7601808)
I think it could be possible for any context-free language, through outputting the parse tree with ranges wrapped with class="symbol-type". CSS's grammar being like this (for those not familiar with the idea): http://www.w3.org/TR/CSS21/grammar.html, and JS's being like this: http://www-archive.mozilla.org/js/language/grammar14.html. You might want to have a black/white list of foundational grammar rules to ignore.
Re:CSS Vocabulary by bbx on Thursday April 17, 2014 @03:07AM (#7602325)
Very neat and straight to the point. I'm writing a book about CSS, and this comes in very handy considering the vocabulary in CSS is usually misused and lacks precision, especially on Stack Overflow (including by me).
Re:CSS Vocabulary by Trufa on Thursday April 17, 2014 @06:25AM (#7602811)
It's so hard at the beginning to google it,since you don't know the names. This is an extremely helpful tool for beginners!
Re:CSS Vocabulary by LanceH on Thursday April 17, 2014 @10:48AM (#7603897)
This is very helpful, because even though I can produce css I sure didn't know the names of anything.
Re:CSS Vocabulary by runarberg on Thursday April 17, 2014 @06:55AM (#7602860)
Really nice. Why did you skip the media query though?

    @media only screen and (min-width: 35em) {
        /* responsive styles */
    }

    @media print {
        /* printed styles */
    }
Re:CSS Vocabulary by SimeVidas on Thursday April 17, 2014 @07:55AM (#7603025)
Page footer:

Made by @sakamies Improvements welcome at https://github.com/sakamies/css-vocabulary

Re:CSS Vocabulary by runarberg on Thursday April 17, 2014 @11:50AM (#7604345)
Thanks for telling me, In fact I did send a pull request on the matter. (Although I don't understand the down-vote for stating a constructive criticism, what if I didn't know the vocabulary for media queries and was genuinely hoping to learn it on this site?).
Re:CSS Vocabulary by SimeVidas on Friday April 18, 2014 @07:02AM (#7608739)
I didn't down-vote.
Re:CSS Vocabulary by bowlofpetunias on Thursday April 17, 2014 @02:52AM (#7602291)
For someone with only superficial knowledge of CSS but who regularly has to communicate with front-end devs, this is very very helpful.

A shared vocabulary is so important in any collaboration.

Re:CSS Vocabulary by reshambabble on Thursday April 17, 2014 @11:21AM (#7604127)
This is a really great visual way to learn CSS vocabulary. Love the simple and clear UX/UI. Have you thought about adding pop ups when you click on each term that explains the exact purpose of each? It could be an interesting way to expand this into a 5 minute self-taught tutorial.
Re:CSS Vocabulary by JazCE on Thursday April 17, 2014 @04:20AM (#7602505)
This is really nice, I might fork it myself and add to it as I'd like to see some more explanation on certain parts, though it would then become something different.
Re:CSS Vocabulary by ArtDev on Thursday April 17, 2014 @12:30PM (#7604586)
I always referred to a declaration block as "rules". A single declaration is a "rule". I am not sure where I picked it up, but it is simpler.
Re:CSS Vocabulary by SquareWheel on Thursday April 17, 2014 @01:34AM (#7602122)
Very neat and intuitive way to learn. I wasn't aware of the difference between "pseudo classes" and "pseudo elements" before.
Re:CSS Vocabulary by hackaflocka on Thursday April 17, 2014 @12:09AM (#7601961)
Great resource.

Anyone know of something like this for Javascript or PHP?

Re:CSS Vocabulary by nnq on Thursday April 17, 2014 @02:01AM (#7602183)
Why do they use `::before` instead of `:before`? Is that a typo?
Re:CSS Vocabulary by agr8man on Thursday April 17, 2014 @02:20AM (#7602225)
The double-colon notation is introduced in order to establish a discrimination between pseudo-classes and pseudo-elements.

Doesn't work with IE.

Re:CSS Vocabulary by windsurfer on Thursday April 17, 2014 @02:34AM (#7602257)
> Doesn't work with IE

That's not true. IE has supported it since IE9 at least. http://msdn.microsoft.com/en-us/library/ie/cc304078%28v=vs.8...

Re:CSS Vocabulary by bzbarsky on Thursday April 17, 2014 @11:40AM (#7604269)
Pseudo-elements use two colons. A small number ("before", "after", "first-line", "first-letter") are grandfathered in as allowing either one or two, for backwards compat back to the days when there was no distinction between pseudo-elements and pseudo-classes in CSS.
Re:CSS Vocabulary by conectorx on Wednesday April 16, 2014 @10:02PM (#7601647)
well css is death so, no, thank you.
Re:CSS Vocabulary by hhsnopek on Wednesday April 16, 2014 @10:09PM (#7601672)
how is CSS dead? CSS is going to live on forever as the base of styling. Stylus, SASS, LESS will always compile to CSS, and their will be a "religious war" of which one to make as the base.
Re:CSS Vocabulary by conectorx on Wednesday April 16, 2014 @11:07PM (#7601838)
just because you use it, or because you like it does not mean is the right approach for styling websites. The future is canvas.
Re:CSS Vocabulary by dredmorbius on Thursday April 17, 2014 @01:14AM (#7602094)
Assuming you're not simply trolling, would you care to clarify and expand your comments?

Are you referring to the HTML 5 canvas element? That's principally intended to provide native graphics capabilities for HTML, not to allow for semantic styling of textual content, as is the case (mostly) for CSS.

Otherwise, your comments here are not constructive nor do they follow the HN guidelines as I read them.

Re:CSS Vocabulary by kingnight on Thursday April 17, 2014 @12:04AM (#7601952)
How would one create a document type page with a canvas? I'm generally curious and would love an example. I've use canvas before, but strictly for image manipulation and exploring animation.

My experience and limited knowledge of it don't lead me to believe it'll replace HTML/CSS documents anytime soon (which are really the starting point before blogs/apps).

What about resizing causing the whole canvas to be wiped away (thats a default behavior right?).

Edit: Also, how do you achieve separation of content and style?

Re:CSS Vocabulary by jarek-foksa on Thursday April 17, 2014 @02:07AM (#7602193)
Canvas is just a low level API for 2D graphics, on top of it you could build your own rendering engine with custom document object model, document serialization format, layout engine, styling engine, etc. This would be an enormous amount of work though, I don't believe that standard HTML/SVG/CSS/DOM are that broken that reimplementing them from scratch would become a viable option.