CSS Flashcards
• What are the names of the individual pieces of a CSS rule?
o Selector, declaration block, property, value.
• In CSS, how do you select elements by their class attribute?
o Use a period “.class”
• In CSS, how do you select elements by their type?
o Simply write the element name – nothing else.
• In CSS, how do you select an element by its id attribute?
o Use a # sign
• Name three different types of values you can use to specify colors in CSS.
o rbg, hex codes, name of colors, etc.
• Name three different types of values you can use to specify colors in CSS.
o rgb, hex codes, name of colors, etc.
• What CSS properties make up the box model?
o Border, margin, padding (page 307), and content
• Which CSS property pushes boxes away from each other?
o The MARGIN is an invisible space around your box.
o It pushes other elements AWAY from the box.
o Margins can have positive or negative values. Setting a negative margin on one side of your box can cause it to overlap other things on the page. Whether you are using the standard or alternative box model, the margin is always added after the size of the visible box has been calculated.
• Which CSS property add space between a box’s content and its border?
o Padding
o Padding is the space between the border of a box and any content contained within it. Adding padding can increase the readability of its contents.
Padding is additional space – and that comes with problems.
Box-sizing border box – it makes it so that the sizing is applied to the border and that which is inside of it.
• What is a pseudo-class?
o A CSS pseudo-class is a keyword added to a selector that specifies a special state of the selected element(s). o For example, :hover can be used to change a button's color when the user's pointer hovers over it.
• What are CSS pseudo-classes useful for?
o SCALABILITY – no need to write long code if you can have it uniform.
o Pseudo-classes let you apply a style to an element not only in relation to the content of the document tree, but also in relation to external factors like the history of the navigator (:visited, for example), the status of its content (like :checked on certain form elements), or the position of the mouse (like :hover, which lets you know if the mouse is over an element or not).
o Applying style
o nth child
• Name two types of units that can be used to adjust font-size in CSS.
o em
o px
o ##%
• What CSS property controls the font used for the text inside an element?
o font-family
o The font CSS shorthand property sets all the different properties of an element’s font. Alternatively, it sets an element’s font to a system font.
• What is the default flex-direction of a flex container?
o row
• What is the default flex-wrap of a flex container?
o No wrap