Reputation: 123
So I'm trying to change make the text display/change color but so far all I can do is change width and height, which doesn't really affect anything in my current situation.
HTML:
<div class="size12-3cLvbJ subtext-3CDbHg spotify-artist">by USAO, Laur</div>
CSS:
.size12-3cLvbJ.subtext-3CDbHg.spotify-artist {
display: inline;
height: 15px;
width: 165px;
background-color: #FFFFFF !important;
}
The display: inline and background-color don't really affect anything. I've tried color: #FFFFFF;
but that didn't do anything either
Upvotes: 1
Views: 1296
Reputation: 31992
how would i change the text color without the text having a class?
Try an inline style, which overrides class styles
<div class="size12-3cLvbJ subtext-3CDbHg spotify-artist" style="color:red">by USAO, Laur</div>
You can also use the font
tag, although be warned support for it was deprecated in HTML5 and support for it across browsers will likely be dropped soon.
<div class="size12-3cLvbJ subtext-3CDbHg spotify-artist"><font color="red">by USAO, Laur</font></div>
I'm trying to theme something so all i have is CSS
Use the color
attribute. For example:
.spotify-artist{
color:red !important;
}
<div class="size12-3cLvbJ subtext-3CDbHg spotify-artist">by USAO, Laur</div>
Upvotes: 0
Reputation: 42304
color:
is indeed the way to go. If your color
is not taking effect, there can be only be three culprits:
CSS rules should always be added with the lowest possible specificity:
!important
declarationsBase level specificity can be seen applying the style correctly here:
.size12-3cLvbJ.subtext-3CDbHg.spotify-artist {
display: inline;
height: 15px;
width: 165px;
background-color: #FFFFFF !important;
color: red; /* Added */
}
<div class="size12-3cLvbJ subtext-3CDbHg spotify-artist">by USAO, Laur</div>
Here is an extended example with colours conflicting:
.size12-3cLvbJ.subtext-3CDbHg.spotify-artist {
display: inline;
height: 15px;
width: 165px;
background-color: #FFFFFF !important;
color: red; /* Added */
}
div {
color: blue; /* Applied, but not specific enough */
}
<div class="size12-3cLvbJ subtext-3CDbHg spotify-artist">by USAO, Laur</div>
<div>Example</div>
You can see this happening by inspecting the element in the F12 Developer Tools (note the strikethrough):
Upvotes: 2