Section 8 - Advanced CSS Flashcards

1
Q

What is the “span” element?

A

used to apply styles to a specific section of text within a larger text block without creating a new line of content

ex:

<p> Hello <span>beautiful</span>world</p>

ex:
display: inline

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

What are the 3 common types of display values?

A
  1. Block
  2. Inline
  3. Inline-block
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe each of the 3 common types of display values?

A
  1. Block - (default) full width, can change width and height
  2. Inline - displays in line with each other, can’t adjust width/height size adjusts according to content
  3. Inline-block - set width/height, elements go in the same line
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What happens if the display is inline or inline-block and you keep adding span elements?

A

they’re going to go into the same line until they can no longer fit onto the width of the web page and they’ll go to the next line

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

What happens when you set the display property to “none”?

A

makes any element on the screen basically disappear

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

What could you use if you want an item on your to-do list to disappear after you check it off?

A

display: none

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

Which display property is the only one that pushes other elements up/down to make room for others?

A

inline-block
(block doesn’t push others away, and inline can’t change width and height)

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

What happens when we have a paragraph element with a width and height set but the display is set to “inline”?

A

it’s not going to respect the height and width we set, it takes the text of the paragraph element as a priority for determining the size

(the contents are priority with inline)

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

An element set to display: block does what?

A

takes up the full width of the page (doesn’t allow elements on the same line)

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

If you make your VS code window smaller and the elements change positions, does that reflect in your code when you view it on a website?

A

No, it still displays like normal (before adjusting the window)

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

What is the “float” property?

A

a CSS property that allows us to wrap text around a particular element

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

How do you use the float property?

A

You target the image element you want the paragraph text in the html to wrap around and you set the image element float to left or right to force the text to the opposite side to wrap around the image

float: left (or right)

(the behavior applies to the paragraph element though)

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

How many values does the float property have?

A

2, left or right

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

What property do you use if you don’t want text to wrap around a floated element?

A

you use the “clear” property so your target element ignores any floated elements nearby in whatever specific direction they are so it doesn’t try to wrap around it (unsticks it)

clear: left, right, both

[clears any responsibility to wrap around things that are floating]

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

How many values can you set for the “clear” property?

A

3

left, right, both

both = both floated elements near it

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

Can you use the float property to float 2 elements at once to have the text wrap around them?

A

Yes

use a selector that targets all desired elements and insert the float property

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

In the exercise, was it better to float the images first to get the text to wrap or move the divs first?

A

it was better to get the text to wrap around the images first before moving anything

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

When don’t we use the float property?

A

We don’t use it in modern web dev/design to move elements, we ONLY use it to wrap text around an element

she’s showing us a better technique to move things later (Flexbox, Grid, Bootstrap, etc)

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

Do we still use the clear property in modern web dev/design?

A

Yes

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

How do you add more than one class to an element?

A

class=”a-class another-class”>

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

How do you add spaces for selector names such as class, id, etc?

A

use a hyphen

a-class
another-class

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

What does a responsive website mean?

A

It responds to the changes in the screen size (someone is using to view the site)

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

What are the 4 main ways of creating responsive websites?

A
  1. Media Queries
  2. CSS Grid
  3. CSS Flexbox
  4. External Frameworks e.g. Bootstrap
24
Q

What is media query?

A

Takes the spot of a selector in your CSS that has a rule to apply the CSS inside curly braces when displaying on a screen below/equal to a certain width (600px wide)

25
Q

What is CSS Grid?

A

A simple system where you can define how you want the columns and rows to be laid out

26
Q

What does display: grid do?

A

it says we’re basically going to use this system of CSS Grid to do the layout

27
Q

What does 1fr mean?

A

1 fraction, fr = equal fraction meaning columns will have the same width

28
Q

What does span do?

A

For example span 2; would have the column take up the entire width of 2 columns across the page (a row block, like for a heading) instead of taking up 1 column width if it was span 1;

29
Q

What’s the difference between Grid and Flexbox? (2)

A

Grid = 2D layouts (columns AND rows)
Flexbox = 1D layouts (single horizontal or vertical row)

30
Q

What does the flex property do in CSS Flexbox?

ie Flex: 1;

A

Makes each card have width distribution (divides up the width equally between cards)

If set to Flex: 1; then it would have EQUAL width distribution across cards but if set to 2 then one would be 2x wider than others

31
Q

In what direction can you make the CSS Flexbox?

A

Horizontal and vertical

32
Q

For a Bootstrap Framework, why is it called a framework?

A

because it’s external

(we use other people’s code)

33
Q

How is a Bootstrap framework different from Grid or Flexbox?

A

It’s not built into CSS like Grid or Flexbox

34
Q

Grid has columns and rows and applies to ___ layouts

A

2D

35
Q

Flexbox allows you to create ____ layouts

A

1D

36
Q

Which 2 methods apply the display property to the parent container?

A

Grid, Flexbox

37
Q

What type of system does Bootstrap have?

A

12 division system (full width of website can be divided into 12 equal portions)

38
Q

For Media Queries, instead of a selector what keyword do we have instead?

A

@media

@media (max-width: 600px) {

39
Q

What is a breakpoint?

A

The width reaches a point (specified by px) where the CSS default styling changes to what’s inside the curly braces

(used for when changing screen sizes, different screen sources like laptops, phones)

40
Q

Media query provides an ___ to the default styling

A

override

41
Q

How do you combine 2 breakpoints?

A

you insert “and” in between 2 breakpoints

@media (min-width: 600px) and (max-width: 900px) {

42
Q

max-width is for what type of screens?

A

smaller screens (any screen size #px or below)

43
Q

min-width is for what type of screens?

A

bigger screens (any screen size #px and up)

44
Q

What direction are you targeting when you say:

@media (max-width: 600px) and (min-width: 900px) {

A

600px and smaller <-
900px and bigger->

(they are going in opposite directions from each other)

45
Q

What direction are you targeting when you say:

@media (min-width: 600px) and (max-width: 900px) {

A

600px and bigger ->
900px and smaller <-

(they’ll meet in the middle, range will be from 600-900)

46
Q

What is the “screen” keyword?

A

a keyword that says apply to all screens which isn’t necessary by default

(not recommend when writing normal media query)

47
Q

What is the”print” keyword?

A

used with the @media query to target only when your website is being printed (to give it a different layout)

48
Q

What are 2 ways to test your responsive website code?

A
  1. In a browser so you can manipulate the window
  2. In Chrome Developer Tools (3 dots > More tools > Developer tools > Dimensions: Responsive)
49
Q

Where do you insert media queries?

A

into the CSS section

50
Q

What’s the CSS selector you use to change the background color of a website?

A

body (to select the whole body) applied in CSS section

body {
background-color: color
}

51
Q

How do you write a media query for:
Desktops: 1601px and more

A

@media (min-width: 1601px) {
body {
background color etc
}
}

52
Q

Mobile devices are usually between what sizes?

A

319px — 480px

53
Q

iPads and Tablets are usually between what sizes?

A

1201px — 1600px

54
Q

Desktops are usually between what sizes?

A

1601px  and more

55
Q

What doe text: justify; do?

A

text: justify; is good to use for text that you want to occupy the whole width (of a div or p area) and not just be left-aligned