CSS Flashcards

(42 cards)

1
Q

What are the names of the individual pieces of a CSS rule?

A

CSS rule consist of a selector and a declaration block

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

In CSS, how do you select elements by their class attribute?

A

With .class name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In CSS, how do you select elements by their type?

A

You write the name of the element as the selector

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

In CSS, how do you select an element by its id attribute?

A

With #id name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Name three different types of values you can use to specify colors in CSS.

A

RGB values, HEX codes, color names

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What CSS properties make up the box model?

A

Border, margin, padding

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which CSS property pushes boxes away from each other?

A

margin

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which CSS property add space between a box’s content and its border?

A

padding

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a pseudo-class?

A

A pseudo-class is keywords that are added to a selector that specifies a special state of the selected elements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are CSS pseudo-classes useful for?

A

They are useful in applying style to an element without having to additional classes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Name at least two units of type size in CSS

A

pixels, percentage, ems

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What CSS property controls the font used for the text inside an element?

A

Font-family

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the default flex-direction of a flex container?

A

Row - horizontal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the default flex-wrap of a flex container?

A

No wrap

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the default value for the position property of HTML elements?

A

Static - Normal Flow

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How does setting position: relative on an element affect document flow?

A

You can shift element without affecting surrounding text and document flow

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

How does setting position: relative on an element affect where it appears on the page?

A

It stays where it is unless you shift it

18
Q

How does setting position: absolute on an element affect document flow?

A

t’s removed from the document flow

19
Q

How does setting position: absolute on an element affect where it appears on the page?

A

Find the boundary and look for a non-static position. Appears nearest non-static parent

20
Q

How do you constrain an absolutely positioned element to a containing block?

A

Set up non-static position

21
Q

What are the four box offset properties?

A

Top, bottom, left, right

22
Q

What are the four components of “the Cascade”.

A

Source order, inheritance, specificity, !important

23
Q

What does the term “source order” mean with respect to CSS?

A

Styling provided for an element last in your stylesheet gets priority

24
Q

How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?

A

Through inheritance if no CSS for that property is directly declared on the child element.

25
List the three selector types in order of increasing specificity.
type, class, id
26
Why is using !important considered bad practice?
It makes debugging more difficult by breaking the natural cascading in your stylesheets
27
The transition property is shorthand for which four CSS properties?
shorthand property for transition-property, transition-duration, transition-timing-function, and transition-delay
28
What event is fired when a user places their cursor in a form control?
focus
29
What event is fired when a user's cursor leaves a form control?
blur
30
what event is fired as a user changes the value of a form control?
input
31
What event is fired when a user clicks the "submit" button within a ?
submit
32
What does the event.preventDefault() method do?
prevents default actions
33
What does submitting a form without event.preventDefault() do?
Automatically load the form values
34
What property of a form element object contains all of the form's control?
elements property
35
What property of form a control object gets and sets its value?
value property
36
What is one risk of writing a lot of code without checking to see if it works so far?
It's hard to know where the error is
37
What is an advantage of having your console open when writing a JavaScript program?
A
38
Give two examples of media features that you can query in an @media rule.
max-width, min-width, height, grid, orientation, etc
39
Which HTML meta tag is used in mobile-responsive web pages?
viewport
40
What is a breakpoint in responsive Web design?
point where our styling can break or styling changes and where the media query is introduced
41
What is the advantage of using a percentage (e.g. 50%) width instead of a fixed (e.g. px) width for a "column" class in a responsive layout?
with percentages the layout adapts to the exact dimensions of the viewport's width.
42
If you introduce CSS rules for a smaller min-width after the styles for a larger min-width in your style sheet, the CSS rules for the smaller min-width will "win". Why is that?
the cascade system.