CSS: Attribute Selectors Flashcards

(5 cards)

1
Q

What are Attribute Selectors?

A

The attribute selector allows you to target HTML elements based on their attributes like the href or title attributes.
a[href] {
color: blue;
text-decoration: underline;
}

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

What is the “title” Attribute?

A

This attribute provides additional information about an element. Here is how you can target links with the title attribute:
a[title] {
font-weight: bold;
text-decoration: none;
}

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

What is the “lang” Attribute?

A

This attribute is used in HTML to specify the language of the content within an element. You might want to style elements differently based on the language they are written in, especially on a multilingual website.
p[lang=”en”] {
font-style: italic;
}

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

What is the “data-lang” Attribute?

A

Custom data attributes like the data-lang attribute are commonly used to store additional information in elements, such as specifying the language used within a specific section of text. Here is how you can style elements based on the data-lang attribute:
div[data-lang=”fr”] {
color: blue;
}

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