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
Q

Set the padding of all checkboxes to 10px and text to green with a solid border

A
{style}
   [type = "checkbox"] {
         padding: 10px;
         color: green;
         border-style: solid;
}
{/style}
26
Q

Which are relative units

A

em

rem

27
Q

What is the order of precedence of classes in CSS

A

Classes lower in the style sheet will override classes above them.

28
Q

Does it matter which order classes are listed within the element

A

No

29
Q

What do you use to override all other CSS styles

A

!important

30
Q

How do you represent white in html

A

ffffff

31
Q

What is the short hex code for red

A

F00

32
Q

What are the different ways to represent color

A
rgb(x,x,x)
#xxxxxx
#xxx
33
Q

How do you declare variables arm and fee within a class penguin and set the values to black and orange respectively

A

.penguin{
–penguin-arm: black;
–penguin-feet: orange;
}

34
Q

How do you apply the variable –cat-skin to the background attribute

A

background: var(–cat-skin);

35
Q

How do you apply a fallback color to the background attribute if your variable –penguin-skin is invalid

A

background: var(–penguin-skin, black)

36
Q

Why is it important to add fall back colors to variables

A

In case of browser compatibility issues

Useful for debugging in case you have typo

37
Q

How do you improve browser compatibility fallbacks

A

adding another property declarations before the declaration with the variable
ex.

background: black;
background: var(–penguin-skin);

38
Q

What is :root

A

pseudo-class selector that matches the root element of the document. Variables created in root will be available globally

39
Q

Where are variables valid

A

Within the selector it was created in and its descendants

40
Q

How do you overwrite the variable –penguin-skin: red that is in :root with white for .penguin class

A

:root{ –penguin-skin: red;}
.penguin{
–penguin-skin:white;
}

41
Q

How do you adjust for styles on media screens if they are bigger or smaller

A

@media (max-width: 300px) {
:root{

}
}