Hello, I have tried to style the id attribute over five times now, I have cleared the code and re-done it a few times but it will not change the color to orange
Here is my code:
style>
body {
background-color: black;
font-family: Monospace;
color: green;
}
.pink-text {
color: pink;
}
.blue-text {
color: blue;
#orange-text {color:orange;}
</style>
<h1 class="pink-text blue-text" id="orange-text">Hello World!</h1>
help, please
.blue-text {
color: blue;
#orange-text {color:orange;}
Should look like
.blue-text {
color: blue;
}
#orange-text {color:orange;}
As @joker314 pointed out, you were missing a curly brace, but it’s also unclear in your code if you are applying the #orange-text
selector correctly.
<style>
body {
background-color: black;
font-family: Monospace;
color: green;
}
.pink-text {
color: pink;
}
.blue-text {
color: blue;
}
#orange-text {color:orange;}
</style>
<h1 id = "orange-text">Hello World!</h1>
Personally, I would choose to use a .orange-text
class instead so it can be reused throughout the project.
1 Like
I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>
) will also add backticks around text.
1 Like
Thanks! this worked. The brace got me again! thanks
that’s what was missing, thanks!
If you’re having this kind of problem a lot, you might look into using a linter. They help you catch problems in your code. That one I linked lets you paste your CSS into a box and checks it, but most code editors also have linters as add-ons so you can see right in your editor when you have a problem. You can get linters for just about any language you’d want to write.
1 Like
@maggiea08 It’s the semicolons that get me all the time.