CSS Style Attributes Flashcards
That’s one way to add style to an element, but a better way is by using CSS, which stands for Cascading Style Sheets.
Inside a ____ element, you can create a CSS selector for all elements
At the top of your code, create a style element like?
Style element would look like?
h2 {color: red;}
Classes are reusable styles added to HTML elements.
- In CSS style element, classes should start with a period.
- In HTML class declarations, classes shouldn’t start with a period.
Create a CSS class called red-text and apply it to your h2 element…
You can apply a class to an HTML element like this:
<h2>CatPhotoApp</h2>
Here’s an example CSS class declaration.
.red-text {
color: red;
}
Inside the tag set the font-size of all p elements to 16 pixels (16px).
p {
font-size: 16px;
}
Classes are reusable styles added to HTML elements.
- In CSS style element, classes should start with a period.
- In HTML class declarations, classes shouldn’t start with a period.
Create a CSS class called red-text and apply it to your h2 element…
You can apply a class to an HTML element like this:
<h2>CatPhotoApp</h2>
Here’s an example CSS class declaration.
.red-text {
color: red;
}
Inside the tag set the font-size of all p elements to 16 pixels (16px).
p {
font-size: 16px;
}
Make all of your p elements use the Monospace font.
p {
font-family: Monospace;
}