2

I have the following bit of HTML:

 <ul class="unstyled" style="font-size:16px;">
     {% if stuff %} {% for eachthing in stuff %}
     <li>
     <a href = "path"> Stuff goes here </a>
     </li>
     {% endfor %} {% else %}
</ul>

Basically I would like to change the text color of the link within the template rather than in the CSS.

How would I do this? I have tried adding a 'color' property to both the element as well as the element but to no avail.

user1328021
  • 9,110
  • 14
  • 47
  • 78

2 Answers2

7

Can't you simply apply a style attribute like this? You must be using color property for ul or li element which won't apply color to <a> element, instead try this

<a href="path" style="color: #ff0000;">Stuff goes here</a>

Or if you change your mind and want to go for CSS than use this

ul.unstyled li a {
   color: #ff0000;
}

Or inherit the parent color

Demo

Mr. Alien
  • 153,751
  • 34
  • 298
  • 278
  • Of course that works -- I was editing the wrong piece of code and wondering 'wtf why doesn't this work' haha :-) I guess that shows why you should make tweaks in the browser first to test it. – user1328021 Dec 07 '12 at 16:52
1

If you want to change the color of the link then you can use the onmouseover to change the color during the hovering. but you cannot change the color without using CSS either implicitly or explicitly

sushant goel
  • 821
  • 6
  • 8