Prep CSS Basics Flashcards

1
Q

What are some characteristics of block?

A

Displays an element as a block element (like <p>).
Starts on a new line
Takes up the whole width</p>

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

What are some characteristics of inline?

A

Displays an element as an inline element (like <span>)</span>

Any height and width properties have NO effect</span>

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

What are some characteristics of inline-block?

A

Displays an element as an inline-level block container.
The element itself is formatted as an inline element, but can apply height and width values

Will line up (flow) next to each other left to right.

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

Describe the syntax of a CSS rule-set.

A

selector {declaration; declaration}
selector {property:value; property:value;)

ex/
h1 {color: blue; font-size:12px}

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

What CSS properties make up the box model?

A

Margin
Border
Padding
Content

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
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
7
Q

Which CSS property pushes box content away from its border?

A

Padding

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

Internal Style Sheet

A

Child of element
Uses tags

Delete card

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

External Style Sheet

A

Uses tag to link to external sheet

External sheet contains code that usually goes btwn tags of internal style sheet

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

Selectors

Least to most specific

A

From least specific –> most specific:

Type: <p>
Class: .description
ID: #special</p>

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

What are these?

Rule set
Selector
Declaration block
Declarations

A

Ruleset: a chunk of CSS code

Selector: which elements to target

Declaration block: curly braces

Declarations: inside the block (property, colon, and then a value)

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

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

A

color keywords
RGB
Hexadecimal
HSL

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

What is a pseudo-class?

A

allows you to select elements based on what state they are in

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

What are CSS pseudo-classes useful for?

A

styling elements when user is interacting with them

ex/ hover, active, focus (text cursor), visited (for URLs)

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

Name two types of units that can be used to adjust font-size in CSS.

A

px (gives full control)

em (multiplier of default text size 16px)

% (can set default font size of body and combine with em)

vw (viewport width)

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

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

A

font-family

17
Q

What are the four components of “the Cascade”.

A

first priority order

  1. importance
  2. specificity (most specific applied)
  3. source order (last provided style is applied)
  4. inheritance (child receives style from parent if child style is undeclared)

4a. only some properties can be inherited by default

18
Q

specificity

A

from least to most specific:

  1. element name type selectors & pseudo elements
  2. class selectors, attribute, and pseudo-classes
  3. ID selectors

no specificity:

  1. *
  2. combinators (+,,~,” “, | | )
19
Q

Why is using !important considered bad practice?

A

debugging more difficult;

breaks the natural cascading in your stylesheets;

hard to override if you need to override it

20
Q

CSS multiplier

A

x1 - element
x10 - class
x100 - ID

the rule with highest multiplier takes precedence

See grid specificity with fish and sharks

21
Q

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

A

position: static

22
Q

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

A

it does not affect document flow

23
Q

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

A

moves it from where it was in normal flow

stays in normal flow & doesn’t affect elements around it

24
Q

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

A

as long as there is a containing block that is not STATIC:

no more normal flow; other elements act as if it is not there and will take over previous occupying space

25
Q

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

A

takes it out of normal flow

26
Q

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

A

position:relative on container

will align to first non-static position parent

27
Q

What are the four box offset properties?

A

top:
bottom:
left:
right:

28
Q

What does the transform property do?

A

makes final adjustments to images

Lets you rotate, scale, skew, or translate an element.

It modifies the coordinate space of the CSS visual formatting model

29
Q

Give four examples of CSS transform functions.

A

rotate
translateY
translate
scale

skew (takes sides and warps it to parallelogram)

matrix (allows you to do all transform functions at once)

30
Q

The transition property is shorthand for which four CSS properties?

A

PDTFD

transition-property
transition-duration
transition-timing-function
transition-delay

put transition property in main class, not pseudoclass

31
Q

Give two examples of media features that you can query in an @media rule.

A

width

hover?

32
Q

Which HTML meta tag is used in mobile-responsive web pages?

A

< meta name=”viewport” content=”width=device-width, initial-scale=1.0” >

whatever device is being used to view webpage, set width of device equal to width of webpage

^^ if viewport tag not used, the browser will create a virtual viewport
(ex/ squeeze it down and make it tiny on a phone)

33
Q

What is a breakpoint in responsive Web design?

A

point where media query fires or becomes “true”

34
Q

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?

A

adapts to parent container size

adapts to fraction of the row that we previously set

35
Q

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?

A

source order