Styling Flashcards

1
Q

How can we style a button to be perfect square in CSS.

A

We could use height and width to style a perfect square

We could also use aspect-ratio set to 1 to style a perfect square.

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

How could be style a button to be a circle in CSS

A

We could style a circle by setting aspect-ratio: 1;

border-radius: 50%;

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

What syntax do we use when setting aspect-ratio in CSS?

A

aspect-ratio: width/height;

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

Does aspect-ratio work with non-replaced content?

A

Yes, aspect-ratio works with non-replaced content (divs, etc)

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

Where in most web-pages would aspect-ratio be useful?

A

When we are using a background-image as a Hero image, we can control its responsiveness with aspect-ratio

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

What is the default style for box-sizing?

What does this mean for the size of a box?

A

Content-box is the default for box-sizing

This means that padding and border-width are added to content size to determine the actual size of the box.

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

What is a typical reset value for box-sizing in CSS

A

box-sizing: border-box;

This resets the box width to be content, padding, and border combined.

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

What are percentage based width and height relative to?

A

They are relative to the space made available by the parent element

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

Where is the border color set?

A

It can be set either with a direct value

or

If not specified it will inherit the text color

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

What does the value currentColor do in Css?

A

It uses the current text color as the color value.

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

Do you need a border to declare a border-radius value?

A

No, you do not.

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

What is the difference between border and outline in CSS

A

Outline does not affect layout and does not change its size or move it.

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

What is the syntax for a outline declaration?

A

outline: [width] [style] [color];

You can also have outline-offset: [value];

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

Should we add styles to our heading elements (h1, h2, h3, etc)

A

Generally no, we should use utility classes to style elements and allow headings to retain semantic value.

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

Why should we avoid styling heading elements/

A

To reserve heading elements for semantic markup and accessibility.

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

How can we add a gradient to allow text to show a bit more clear?

A

background: linear-gradient(top color, bottom color)

17
Q

What background effect might we use to make text pop?

A

we might use background: linear-gradient(top, bottom)

18
Q

If we have a group of similar containers and would like to highlight one with different colors, what might be an option?

A

To highlight a single card or container, we might locally redefine a primary variable with new values

–primary-clr: var(–accent-clr)

19
Q

How to we alter the value of a variable based on a media query in CSS?

A

We can redefine the :root variable value in a media query

@media (min-width: 800px) {

:root {

–font-size: 3rem }

}

20
Q

Where is the before pseudo-element inserted (::before)?

A

It is inserted before the content of the element selector, not before the element itself.

21
Q

Where is the after pseudo-selector inserted (::after)?

A

it is inserted after the content on the selector (not after the selector itself)

22
Q

Can we use ::before or ::after with images?

A

No, because images are replaced content, they don’t actually have content per-se

23
Q

When should we add breakpoints to our CSS?

A

We should consider looking at our layout and basing breakpoints on when the layout begins to fail.

24
Q

When does em not scale relative to the parent element’s font-size?

A

When we use em to control padding on an element, the padding relative size is based on the font-size of the element with the padding.

25
Q

What is the main benefit of setting padding and margins of elements containing typography in ems?

A

The main benefit is that these paddings and margins will scale when font-size changes with styling or media queries.

26
Q

With the :last-child pseudo-class, where is the “last-child” determined from?

A

The :last-child pseudo-class looks to see if the prepended selector is the last-child of an element, and will apply the style rule to that selector:

li:last-child - looks for an li that is the last-child of a parent element. If is exists, that li get the style rule applied.