CSS Flashcards

1
Q

Change the following text to blue with inline style

{h2}CatPhotoApp{/h2}

A

{h2 style=”color: blue;”}CatPhotoApp{/h2}

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

How do you make all h2 elements red

A
{style}
   h2{
        color:red;
   }
{/style}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Create a CSS class called green-text and apply it to a h1 element

A
{style}
   .green-text{
       color:green;
   }
{/style}

{h1 class=”green-text”} Hello world{/h1}

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

how do you change the font size of all h2 elements to 20px

A
{style}
   h2 {
       font-size: 20px;
}
{/style}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Set the font of all p elements to serif

A
{style}
   p {
      font-family: serif;
}
{/style}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Import the lobster font from https://fonts.googleapis.com/css?family=Lobster and use it on a p element

A

{link href=”https://fonts.googleapis.com/css?family=Lobster” rel=”stylesheet” type=”text/css”}
{style}
p { font-family: Lobster;}
{/style}

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

Set font of h2 element to Helvetica but degrade to sans-serif if it is not available

A
{style}
   h2 {
        font-family: Helvetica, sans-serif;
   }
{/style}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

create a class called super-wide that sets the width to 500px

A
{style}
   .Super-Wide{
       width: 500px;
   }
{/style}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

create a class called smaller-image that sets the height to 100px

A
{style}
   .smaller-image {
       height: 100px;
   }
{/style}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Create a class called thick-green-border that adds a 10px, solid green border around an element

A
{style}
   .thick-green-border{
       border-color: green;
       border-width: 20px;
       border-style: solid;
}
{/style}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do you add multiple classes to an element

A

{p class=”class1 class2”}

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

How do you make rounded border that is 10px

A

border-radius: 10px;

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

Make a border radius of 75%

A

border-radius: 75%;

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

Create class silver-color with background color of silver

A
{style}
   .silver-color{
      background-color: silver;
}
{/style}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Give id element cat-photo-form a background color of green

A
{style}
   #cat-photo-form{
       background-color: green;
   }
{/style}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the properties that surround each html element

A

margin
border
padding

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

What does padding control

A

space between the element’s content and the border

18
Q

What does margin control

A

space between the element’s border and surrounding elements

19
Q

What does a negative margin do

A

Make the element grow larger

20
Q

How do you control each individual side of an element’s padding

A

padding-top
padding-bottom
padding-left
padding-right

21
Q

How do you control each individual side of an element’s margin

A

margin-top
margin-right
margin-bottom
margin-left

22
Q

Instead of using padding-top, padding-right, padding-bottom, padding-left, how do you specify 10px for the top, 20px for the right, 10 px for the bottom and 20 px for the left

A

padding: 10px 20px 10px 20px;

23
Q

Instead of using margin-top, margin-right, margin-bottom, margin-left, how do you specify 20px for the top, 40px for the right, 20px for the bottom and 40px for the left

A

margin: 20px 40px 20px 40px;

24
Q

Set the margin of all radio buttons to 20px 0px 20px 0px

A
{stye}
    [type = "radio"] {
        margin: 20px 0px 20px 0px;
}
{/style}
25
Set the padding of all checkboxes to 10px and text to green with a solid border
``` {style} [type = "checkbox"] { padding: 10px; color: green; border-style: solid; } {/style} ```
26
Which are relative units
em | rem
27
What is the order of precedence of classes in CSS
Classes lower in the style sheet will override classes above them.
28
Does it matter which order classes are listed within the element
No
29
What do you use to override all other CSS styles
!important
30
How do you represent white in html
#ffffff
31
What is the short hex code for red
#F00
32
What are the different ways to represent color
``` rgb(x,x,x) #xxxxxx #xxx ```
33
How do you declare variables arm and fee within a class penguin and set the values to black and orange respectively
.penguin{ --penguin-arm: black; --penguin-feet: orange; }
34
How do you apply the variable --cat-skin to the background attribute
background: var(--cat-skin);
35
How do you apply a fallback color to the background attribute if your variable --penguin-skin is invalid
background: var(--penguin-skin, black)
36
Why is it important to add fall back colors to variables
In case of browser compatibility issues | Useful for debugging in case you have typo
37
How do you improve browser compatibility fallbacks
adding another property declarations before the declaration with the variable ex. background: black; background: var(--penguin-skin);
38
What is :root
pseudo-class selector that matches the root element of the document. Variables created in root will be available globally
39
Where are variables valid
Within the selector it was created in and its descendants
40
How do you overwrite the variable --penguin-skin: red that is in :root with white for .penguin class
:root{ --penguin-skin: red;} .penguin{ --penguin-skin:white; }
41
How do you adjust for styles on media screens if they are bigger or smaller
@media (max-width: 300px) { :root{ } }