CSS Style Attributes Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

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?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Style element would look like?

A

h2 {color: red;}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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…

A

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;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Inside the tag set the font-size of all p elements to 16 pixels (16px).

A

p {
font-size: 16px;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

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…

A

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;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Inside the tag set the font-size of all p elements to 16 pixels (16px).

A

p {
font-size: 16px;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Make all of your p elements use the Monospace font.

A

p {
font-family: Monospace;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly