CSS Flashcards

1
Q

What does the . before the class name mean?

A

differentiates between a tag and a class

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

What happens?
.title{
color: red;
}
.title{
color: blue;
}

A

The last one will be displayed

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

What happens?
.main-brand-2{
color: red;
}
.title-2{
color: green;
}

<h1>This is a heading</h1>

A

Will be green, as it is last. Easier to think of as that something can have multiple classes, and css works that it will apply the first, then update as it goes along

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

What happens?
.main-brand-2.title-2{
color: red;
}
.title-2{
color: green;
}
</style>

<h1>This is a heading</h1>

A

The first one bc it is more specific. (DO NOT ADD SPACE)

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

What happens?

<div>
<div></div>
</div>

<style>

.test-parent{
    width: 100px;
    height: 100px;
    background-color: blue;
}
.test-child{
    width: 50px;
    height: 50px;
    background-color: red;
}
</style>
A

Will have a blue box that is 100 x 100, and in it a red 50 x 50 box

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

Specifity order

A

Tags are your base level of specificity
Classes are always more specific than tags
Ids are always more specific than classes

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

What should you put at the start of every css code relating to the box model?

A

*, *::before, ::after {
padding: 0;
margin: 0;
box-sizing: border-box;

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

How to change boldness of text

A

font-weight

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

Different types of font-weight

A

normal, bold, light, 100, 700

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

How to change font size

A

font-size

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

What is text-decoration?

A

Decorates text

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

Examples of text-decoration

A

underline, underline dotted, green wavy underline etc

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

How to put a border on text

A

border: 3px solid pink;

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

What is text-transform used for?

A

capitalize, uppercase, lowercase

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

How to use the hover element?

A

Style your element e.g. a button, then make a separate styling with :hover after you state your class. Style that, and then the button will appear as the first class, and when hovering it will display the :hover element

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

What does adding :first-child do?

A

Adds whatever styling inside it to the first child

17
Q

What does display:inline do?

A

▪ Makes the element behave like text, allows things to sit beside it
▪ Unable to change values of some properties like height, width, padding, or margin

18
Q

What does display:block do?

A

▪ Makes the tag element take up the full width of the screen
▪ Able to change values of properties

19
Q

What does display:inline-block do?

A

Makes the elements behave as though it was inline, but with the ability to change values of properties like height, height, width, padding, margin, etc…

20
Q

What does display:flex and inline-flex do?

A

Changes the element to a “flex
container” and allows you to change the layout of the children inside the element

21
Q

What does display:flex do?

A

Takes up the entire width of the screen

22
Q

What does display:inline-flex do?

A

Hugs the contents

23
Q

What does justify-content do?

A

Determines the spacing of elements within a container on the horizontal axis

24
Q

What does display:block and inline-block do?

A

Similar to “block” and “inline-block” in that it affects
the elements around it, but gains access to new properties that affect the element itself and those inside it. Given the ability to control children’s spacing in two-dimensions

25
Q

What does the * class do?

A

Selects everything

26
Q

What to do if you want to set distance and it be the same regardless of margin, padding etc..

A

*, *::before, *::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}

27
Q

What to do if you have to code a recipe page and want a thing in the middle?

A

position: relative;
left: 50%;
transform: translateX(-50%);