CSS Flashcards
Change the following text to blue with inline style
{h2}CatPhotoApp{/h2}
{h2 style=”color: blue;”}CatPhotoApp{/h2}
How do you make all h2 elements red
{style} h2{ color:red; } {/style}
Create a CSS class called green-text and apply it to a h1 element
{style} .green-text{ color:green; } {/style}
{h1 class=”green-text”} Hello world{/h1}
how do you change the font size of all h2 elements to 20px
{style} h2 { font-size: 20px; } {/style}
Set the font of all p elements to serif
{style} p { font-family: serif; } {/style}
Import the lobster font from https://fonts.googleapis.com/css?family=Lobster and use it on a p element
{link href=”https://fonts.googleapis.com/css?family=Lobster” rel=”stylesheet” type=”text/css”}
{style}
p { font-family: Lobster;}
{/style}
Set font of h2 element to Helvetica but degrade to sans-serif if it is not available
{style} h2 { font-family: Helvetica, sans-serif; } {/style}
create a class called super-wide that sets the width to 500px
{style} .Super-Wide{ width: 500px; } {/style}
create a class called smaller-image that sets the height to 100px
{style} .smaller-image { height: 100px; } {/style}
Create a class called thick-green-border that adds a 10px, solid green border around an element
{style} .thick-green-border{ border-color: green; border-width: 20px; border-style: solid; } {/style}
How do you add multiple classes to an element
{p class=”class1 class2”}
How do you make rounded border that is 10px
border-radius: 10px;
Make a border radius of 75%
border-radius: 75%;
Create class silver-color with background color of silver
{style} .silver-color{ background-color: silver; } {/style}
Give id element cat-photo-form a background color of green
{style} #cat-photo-form{ background-color: green; } {/style}
What are the properties that surround each html element
margin
border
padding
What does padding control
space between the element’s content and the border
What does margin control
space between the element’s border and surrounding elements
What does a negative margin do
Make the element grow larger
How do you control each individual side of an element’s padding
padding-top
padding-bottom
padding-left
padding-right
How do you control each individual side of an element’s margin
margin-top
margin-right
margin-bottom
margin-left
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
padding: 10px 20px 10px 20px;
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
margin: 20px 40px 20px 40px;
Set the margin of all radio buttons to 20px 0px 20px 0px
{stye} [type = "radio"] { margin: 20px 0px 20px 0px; } {/style}
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}
Which are relative units
em
rem
What is the order of precedence of classes in CSS
Classes lower in the style sheet will override classes above them.
Does it matter which order classes are listed within the element
No
What do you use to override all other CSS styles
!important
How do you represent white in html
ffffff
What is the short hex code for red
F00
What are the different ways to represent color
rgb(x,x,x) #xxxxxx #xxx
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;
}
How do you apply the variable –cat-skin to the background attribute
background: var(–cat-skin);
How do you apply a fallback color to the background attribute if your variable –penguin-skin is invalid
background: var(–penguin-skin, black)
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
How do you improve browser compatibility fallbacks
adding another property declarations before the declaration with the variable
ex.
background: black;
background: var(–penguin-skin);
What is :root
pseudo-class selector that matches the root element of the document. Variables created in root will be available globally
Where are variables valid
Within the selector it was created in and its descendants
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;
}
How do you adjust for styles on media screens if they are bigger or smaller
@media (max-width: 300px) {
:root{
}
}