1

朋友们我想将以下 URL 的默认蓝色更改为 RED ,我尝试使用 style="color:red 但没有帮助。请提出更好的方法。

<div class="row-fluid">
    <div class="span12" style="color:red"><a href="/event/alert/recipient/list/${alertStatusForm.forAlert.id}" class="underline">${fn:length(alertStatusForm.totalNotSentRecipient)}</a>
    </div>
</div>
4

5 回答 5

7

You need to edit the actual a element. You can do this multiple ways.

In your CSS File (this will edit all links)

a:active, a:link, a:visited {
    color: red;
}

With Inline Styling

Apply the style directly to the a element.

<a style="color: red" ...

Or, create a class in your CSS File

You could create a class in your CSS file:

a.myLink:active, a.myLink:link, a.myLink:visited {
    color: red;
}

Then apply the class to your link:

<a class="myLink" ...
于 2013-07-26T14:42:41.473 回答
2

我看到您的<a>链接具有“下划线”类。您可以将此 css 代码添加到您的 CSS 文件中以使文本变为红色:

.underline a:active, .underline a:link, .underline a:visited {
    color: red;
}

或直接在 HTML 中应用它,如下所示:

<div class="row-fluid">
    <div class="span12"><a style="color:red" href="/event/alert/recipient/list/${alertStatusForm.forAlert.id}" class="underline">${fn:length(alertStatusForm.totalNotSentRecipient)}</a>
    </div>
</div>
于 2013-07-26T14:45:13.730 回答
2

您将颜色应用于 div,您需要更改colora不是div

现场演示

<div class="row-fluid"><div class="span12" ><a style="color:red" href="/event/alert/recipient/list/${alertStatusForm.forAlert.id}" class="underline">${fn:length(alertStatusForm.totalNotSentRecipient)}</a></div></div>

使用css 类而不是使用样式属性直接更改样式通常是一个好习惯。

CSS

.red-color-a
{
   color:red;
}

HTML

<div class="row-fluid"><div class="span12" ><a class="red-color-a" href="/event/alert/recipient/list/${alertStatusForm.forAlert.id}" class="underline">${fn:length(alertStatusForm.totalNotSentRecipient)}</a></div></div>
于 2013-07-26T14:43:04.127 回答
1

使用文字装饰 无

<a href="http://www.google.com" style="text-decoration:none;color:red">Visit google</a>
于 2013-07-26T15:14:58.717 回答
1

您需要定位<a>标签而不是其父范围:

<a style="color:red"> ... </a>

锚标签的默认样式将覆盖<span>包装它的标签。

于 2013-07-26T14:43:01.317 回答