so i've just finished a book to learn CSS. (known HTML since high school but didn't have the initiative to pick up CSS 'til now).
anyways, ever since i started reading about pseudo-classes in CSS i always thought it was a:
- vast assortment of states for almost any tags. this would allow different formatting/layouting for any STATE of ANY ELEMENT. this would then be the mechanism to have pop-up/drop-down/tabbed menus/interactive buttons, controlling the INTERACTIVE look and feel of a page. this made sense, as CSS has always been aimed for formatting/layouting.
anyways, isn't it better if CSS does atleast most of the INTERACTIVE look and feel as i delineated in the point block above? implementing a drop-down navigation menu would then be like:
- if :hover is true for a button, then change the block formatting (as the button is actually a sinlge lined block). the children blocks would have their "display" style property turned on (previously hidden). they are then set on having a solid background color, padding, borders, etc.. now dispalyed, the user may interact with them like ordinary links.
i guess my biggest objection to implementing the interactive look and feel using JS is that you can't always fall reliably back on it.
- older and rarer browsers may full support of CSS but not JS.
- JS maybe disabled
- JS is usually slower (unless script is turned into binary and probably JIT-ed). this is more evident in mobile devices.