更改链接文字的字体颜色 [英] Changing font color of link text

查看:120
本文介绍了更改链接文字的字体颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下的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>

基本上,我想更改模板中的链接的文本颜色,而不是CSS。

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

我该如何做?我尝试给元素和元素添加一个'color'属性,但没有效果。

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.

推荐答案

你只是应用这样的样式属性?您必须使用 ul li 的颜色属性,不适用 color < a> 元素,请改用

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>

或者如果你改变主意,想要使用CSS比使用

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

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

或继承父颜色

演示

这篇关于更改链接文字的字体颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆