Creating a class override

Status
This thread has been locked.

El_Tristanio

Supreme
Feedback score
10
Posts
643
Reactions
183
Resources
0
So, this is my code

<style>
body {
background-color: black;
font-family: Monospace;
color: green;
}
#orange-text {
color: orange;
}
#white-text {
color: white;
}
.pink-text {
color: pink;
}
.blue-text {
color: blue;
}
.white-text {
color: white;
}
</style>
<h1 id="white-text" class="pink-text blue-text white-text">Hello World!</h1>
and i need to give h1 an id of white-text and orange-text . How can this be done
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

El_Tristanio

Supreme
Feedback score
10
Posts
643
Reactions
183
Resources
0
Here is a screenshot of my page https://gyazo.com/6e2f48488816c73e51840b7e04cbc3b8[DOUBLEPOST=1508972241][/DOUBLEPOST]"
So we've proven that id declarations override class declarations, regardless of where they are declared in your style element CSS.

There are other ways that you can override CSS. Do you remember inline styles?

Use an in-line style to try to make our h1 element white. Remember, in line styles look like this:

<h1 style="color: green">

Leave the blue-text and pink-text classes on your h1 element.





Get a hint


Your h1 element should have the class pink-text.

Your h1 element should have the class blue-text.

Your h1 element should have the id of orange-text.

Give your h1 element the inline style of color: white.

Your h1 element should be white.

"
my code
"

<style>
body {
background-color: black;
font-family: Monospace;
color: green;
}
#orange-text {
color: orange;
}
#white-text {
color: white;
}
.pink-text {
color: pink;
}
.blue-text {
color: blue;
}
.white-text {
color: white;
}
h1 {
color: #FFFFFF;
}
</style>
<h1 style="white-text" id="orange-text" class="pink-text blue-text white-text">Hello World!</h1>
"
 
Last edited:

WillFTW

Feedback score
2
Posts
219
Reactions
98
Resources
0
Why are you applying several color classes to one element despite knowing only one will be used?
 
Status
This thread has been locked.
Top