CSS Basics Flashcards
(119 cards)
Where do you write your CSS?
In a separate file
What part of HTML do you link your CSS?
The Head
How to write link tag to link CSS to HTML? Where do you write it?
Write in HTML head
< link rel= “stylesheet” href= “path” >
p{
color: red;
font-weight: bold;
}
What is P?
The selector
p{
color: red;
font-weight: bold;
}
What is:
Color: red;
A declaration (line)
p{
color: red;
font-weight: bold;
}
What is
{
color: red;
font-weight: bold;
}
Declaration Block
What is
p{
color: red;
font-weight: bold;
}
A rule
p{
color: red;
font-weight: bold;
}
What is color?
Property
p{
color: red;
font-weight: bold;
}
What is red?
A value
p{
color: red;
font-weight: bold;
}
What happens if you forget ;?
The stuff after might break/ no render
What is the cascade principle?
Read CSS from top to bottom.
Code below overrides code above
Different parts of CSS have stronger value than others. What is this point system called?
Specificity weight
p{
color: red;
font-weight: bold;
}
p{
color: blue
}
If you want P to be red what can you do? What ex.
Give P a higher specificity weight (ex. Add a class)
4 ways to CSS color?
Word
Hex
RGBa
HSLa
What color property?
0, 100%, 50%, 1
HSLa
Hue, saturation, light
What CSS color property? What does the last number mean?
(255, 0, 0, 1);
RGBa.
Last number = transparency
FF0000
What color property?
Hex
What’s an alpha channel and what property do you find it? What’s the range?
Alpha = the a in RGBa or HSLa = transparency label
Range = .01 -1
How to write CSS font-family? Explain the different parts.
Write link in Head of HTML. Then in CSS…
P{
font-family: ‘sans pro’, ‘helvetica’ sans-serif;
Sans pro = 1st choice
All others = backups
How to link font family to HTML? Where to write it? What does it look like on the CSS side?
In head.
Html = < link href = “ URL of font “ rel = “ stylesheet “ >
CSS = font - family : ‘ font 1 ‘ , ‘ font choice 2 ‘ font choice 3 ;
Where do you get new font links?
Check google fonts
When adding fonts to your HTML, do you put the link before or after your CSS stylesheet link? Why?
Before!
The CSS has instructions for the font. CSS cant load the font, if the font not available
Section
——p
How to make p red?
Section > p{
color: red;
}
> is a parent child selection
Section
>article
»p
What is article to section?
Article = direct descendant of section