CSS Flashcards
What does CSS stand for?
Cascading Style Sheets
What are the two parts of a CSS rule-set?
A CSS rule-set consists of a selector and a declaration block
What are the five categories of CSS selectors?
Simple, Combinator, Pseudo-class, Pseudo-elements, and Attribute selectors
What is the CSS Universal selector?
*
How do you group multiple selectors?
With a comma between them?
Ex: h1, h2, p {…}
What symbol is used for id selectors?
#
What symbol is used for class selectors?
.
True or False: Elements can only have one class for styling.
False, HTML elements can refer to more than one class.
How can you specify that only specific HTML elements (such as h1) should be affected by a class (such as header)?
You would have the element followed by the class with a period in between and no spaces. h1.header {...}
What symbols do you use to hold CSS comments?
/* CSS comments in here */
CSS colors are specified using predefined color name or…
RGB, HEX, HSL, RGBA, HSLA values
What does the A in HSLA and RGBA mean?
The A stands for alpha channel - which specifies the opacity for a color
What is the formula for a RGB value?
rgb(red, green, blue)
What is the formula for a HSL value?
hsl(hue, saturation, lightness)
What is the formula for a HEX value?
rrggbb [r = red, g = green, b = blue]
How do you insert an background image?
background-image: url(“path”);
True or False: The background-image property repeats an image both horizontally and vertically by default.
True.
What is used to repeat a background horizontally? Vertically?
Horizontally –> background-repeat: repeat-x;
Vertically –> background-repeat: repeat-y;
What is used to show the background image only once?
background-repeat: no-repeat;
Using “fixed” or “scroll” what property can specify whether the background image should scroll or not with the rest of the page?
background-attachment
What is the shorthand for specifying all the background properties? And what is the order of the property values?
background: (color) (image) (repeat) (attachment) (position);
How many different border-styles are there? And what are they?
10.
dotted, dashed, solid, double, groove, ridge, inset, outset, none, hidden
What are the different values for the border-style property, if not using one for all?
top, right, bottom, and left border
What property specifies the width of the four borders?
The border-width property
What property sets the color of the four borders?
The border-color property
What is the ordering of border properties for the border shorthand? And which one is required?
border: (width) (style) (color);
style is required
What is property is used to add rounded borders to an element?
The border-radius property
What CSS property is used to create space around elements, outside of any defined borders?
CSS margin
Setting the CSS margin to “auto” does what?
Setting the margin property to “auto” horizontally centers the element within its container
What value would you use for a CSS margin if you wanted the child element to copy the styling of the parent element?
“Inherit”
What is margin collapse?
Top and bottom margins of elements are sometimes collapsed into a single margin that is equal to the largest of the two margins.
What CSS property is used to create space around an element’s content, inside of any defined borders?
CSS padding