CSS Flashcards
CSS is a visual markup and adds Semantics to XML.
How do you include CSS to your XML document?
By inserting it as a processing instruction.
The first attribute indicates we are using the CSS language
The second attribute gives the location
What are selectors and declarations in CSS?
Selectors should refer to paths in a tree and be able to test attribute value
Declarations should be able to state what visual property is being changed & the value
selector { declaration; …; declaration; }
declaration = property : value
Tip: Declarations should filtered down the document tree (parent and it’s children)
What is the difference between universal and type selectors?
Universal selector matches the name of any element
* { font-size: 24pt; }
Type selector matches the name of a document language element
TITLE { font-size: 24pt; }
What are the two descendant selectors and how do they work?
Descendant selector combines elements seperated by a space. Amends the final element (in terms of the declaration) if it is any descendant of the previous element.
CONTACT TEL {color:orange;}
Tip: Can combine with universal selectors A * D { color:red; }
Child Descendant selector only matches direct descendants (children)
CONTACT > TEL { font-size: 24pt; }
Tip: Can combine both types CONTACT > TEL HOME
What are the two common attribute selectors?
[att] matches when the element sets the [att] attribute
[att=”val”] matches when the element sets the [att] attribute with the value “val”
What are Pseudo Classes and Pseudo Elements
They are based on information outside the document tree
selector:pseudo {declarations}
Pseudo Elements refer to structural information which
isn’t marked up but still useful
OPENING:before {content: “Dear”}
CLOSING:after {content: “Kindest Regards”}
Pseudo Classes specify other characteristic properties of elements
[e.g hover & active]
HIDING:hover {declarations}
Name some relative units
- em: the ‘font-size’ of the relevant font
- ex: the ‘x-height’ of the relevant font
- px: pixels, relative to the viewing device
Name some absolute units
- in: inches
- cm: centimeters
- mm: millimeters
- pt: points
What are the Limitations to CSS?
- Can’t Restructure a document
Unable to sort or convert logical elements to a table (html recipe example) - Can’t Remove a document
Can hide with display:none but it won’t actually remove the data. Still can see in the source code - Can’t Compute using the data content or its structure
Unable to use the output data, sort, make ENUMs. (Can count with xslt)