Freecodecamp random quiz - CSS Flashcards
What is the attribute you attach to a form that specifies where the form will be submitted to?
The “action” attribute.
How can you prevent a user from submitting a form without filling in certain inputs, but only using html?
Add a “required” attribute to the input elements that are required. The required attribute does not need a value.
< input type=”text” required >
Why is it considered best practice for a label to have a “for” attribute linking it to an input?
It allows assistive technologies to create a linked relationship between the label and the related input element.
Why is it considered best practice for a label to have a “for” attribute linking it to an input?
It allows assistive technologies to create a linked relationship between the label and the related input element.
How do you tell the browser what version of HTML you are using?
Declare the Doctype of an HTML Document.
< !DOCTYPE html >
This means HTML version 5
What is an attribute selector in CSS? give an example of one!
A way of selecting an element based on an attribute and that attributes value.
They are placed in square brackets [attr=value]
For example [type=checkbox] would be a common one to use.
What is the size of an em based on ?
An em is based on the size of an element’s font. If you use it to set the font-size property itself, it’s relative to the parent’s font-size.
What is CSS inheritance?
A style rule applied to a parent element will be inherited by its children.
An element is styled with 2 classes that both style the color property. What determines which style rule is applied.
< style >
.pink-text {
color: pink;
}
.blue-text{
color: blue;
}
< /style >
< h1 class=”pink-text blue-text” >Welcome< /h1 >
The order of the css declarations in the style sheet. The .blue-text class declaration is last so will beat pink-text, even if you swapped the class names in the element:
< h1 class=”blue-text pink-text” >Still blue< /h1 >
Will an id attribute CSS declaration override a class attribute CSS declaration?
Yes id attribute CSS declarations have higher precedence. #id beats .class
Do inline styles override styles in style tags and external style sheets?
Yes they do!
How many unique colours are there in the css hexidecimal system?
16^6 = 16, 777, 216 unique colours!
How many unique colours are there in the css rgb() system?
each colour red, green and blue has a range of 0-255 so …
256^3 = 16, 777, 216 unique colours the same as the css hexadecimal system.
How do you declare a CSS variable?
precede it with two hyphens
–main-font-color: #6739fd;
How do you use a custom CSS variable?
Use the var( ) method.
background: var(–bg-color);