- This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
Viewing 7 posts - 1 through 7 (of 7 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Hi,
My app attempts to use multiple colors for links depending on some business rule.
For instance, for the following case, I attempted to use RED for the link color. However, since I have a complex inherited CSS file for the entire app, I thought adding the !important at the end would overwrite similar coding for the a (link), but it has effects. How to correct it? Thanks.
<span>
<a href="#">Cancer</a>
</span>
Without seeing the problem it’s hard to help.
Can you reproduce it Codepen.io?
My original code was like below:
<span style="a{color:red !important}"><a href="#" onclick="loadRightDoc('kPoints.cfm?t=','Cancer')">Cancer</a>
</span>
No…that wouldn’t work. you’re appling a style (badly) to the span
not the link.
Your inline style is invalid. You can’t apply an inline style to a child by applying it to a parent.
You’re trying to apply a CSS Selector inline..and that’s a no-no.
Ok. I see. So, now, I apply it direct for the link (I know, it’s bad practice for inline CSS but bear with me, solve it first…).
The following code still did not work, any idea as to why? Thanks.
<a href="#" onclick="loadRightDoc('kPoints.cfm?t=','Immunotherapy')" style="a{color:#7A30A0}">Immunotherapy</a>
Incorrect syntax again (you were having a similar problem on this thread earlier today https://css-tricks.com/forums/topic/how-to-make-textcontent-in-the-2nd-td-top-aligned/#post-249191 )
If you’re going to use inline styles, might be worth reading up on it as a refresher http://www.w3schools.com/css/css_howto.asp
@Beverleyh, yeah, you’re right, embarrassing, I underestimated CSS or was mindless… Thanks.