CSS Flashcards
Why CSS?
Allow removing presentation information from the content (document).
Why creating an external css file?
Organization and reutilization.
Who maintains css?
W3C. World wide web consortium.
When css1 was released?
1996
When to check which browsers support which version of css?
Quirksmode.org/css/contents.html
What are selectors?
Define where the style need to be applied.
What are the variations of the selectors?
By element, e.g: body
ID selector, e.g #menu
Class selector, e.g .bookTitle
What are the variations of the selectors?
By element, e.g: body
ID selector, e.g #menu
Class selector, e.g .bookTitle
How to make multiple selectors in one line?
H1,h2
Comma
What’s a descendant selector?
Define css for a specific element or any other thing when anywhere inside another element or thing:
Div p
Apply css to any paragraph at any level inside a div
What’s a child selector?
Apply the css to a element or thing inside directly beneath the other element or thing
Div > p
Apply css to any p that is direct child of a div
What’s an attribute selector?
Apply css to a element or thing that has a specific attribute and value
Img[alt=spacer]
What are css property variation for keyword?
Thin, thick and larger.
What’s a pseudo class selector?
Is a selector that is given by the browser and extends common css selectors. e.g: li: last-child or element state (such as hover).
Apply css to a if it was already visited
What are css property values for physical measurements?
Inches (in), points (pt), picas (pc)
How to specify css property values for screen measurements?
Px, % and em
How to specify colors?
rgbhexa and rgb(r,g,b)
What’s a functional notation?
Means it looks like a function: rgb()
Where the css can come from?
Can come from:
- The author of the website itself (inline, embedded or css files);
- User stylesheet (the user, or website consume can define styles for every website it visits)
- The browser also can have a its own styles where there are no other rules in place.
What’s CSS precedence?
When the same element’s property is applied more than once and one has more weight than other. The cascade part of CSS means precedence.
What’s the css precedence for each css source?
default > user > website author
Website author has the highest weight.
How to override css precedence?
!important
What happens if the same element property is defined more than once in the same source?
If the same css rule is applied to the same element the last defined wins. The browser tool shows a strikethrough in the property.
how to import css from another file?
@import url(myOtherCSSFile.css)
what does dom stand for?
Document object model.
whats a css reset?
Removes any css defined by the browser or any other source.
What is specificity?
Decides who wins in the style definition.
The more specific the more badass. Inline wins everything.
What’s ABC?
A= Count of ID selectors B = Count of class and attribute selector C = Count of type selectors
A = Strongest
- applies to everything, super low specificity.
What’s inheritance in css?
Means some styles might be applied to child elements, like font. Not all properties are “inheretable”.
What’s a box model?
Every element generates boxes.
What are the main box properties
border, padding and margin. Padding push the content inwards and margin outwards.
The padding and margin border can be only defined equally?
No. There are properties that can be defined for each side, such as as padding-left.
What’s the shortcut syntax to define all four sides of the boxes?
margin: 0 3px 0 3px. clockwise: top, right, bottom and left.
What happens when bot and bottom margins overlaps/touch each other?
They do NOT stack up. Margin sets the space between elements.
What’s display and visibility properties?
It means the element will be inline or occupy a new line. Visibility means if it is going to be shown.
How to define font in CSS?
font-family