Saturday 2 August 2014

CSS Syntax

CSS syntax comprises a few fundamental pieces; rules, selectors, declarations, properties and values.
css-best-rule
This CSS rule contains all the other bits and bobs we just mentioned.
css-best-selector-declaration
Selectors point at elements within the HTML markup, then the declarations within the curly braces define how those elements should be styled. There can be multiple declarations within a single rule; each declaration comprising a property with an associated value.
css-best-property-value
There are many ways you can select HTML elements, from straightforward type selectors:
css-best-type-selector
This will select all images and apply zero padding to all of them.
Then we have class selectors, which point to all elements with a specific class applied to them. Take a look at this markup, with its corresponding CSS:
css-best-class-selector-markup
Here's an anchor, of which there could be many..
css-best-class-selector
..then this will select all anchors with a class of "highlight" and make them orange.