Html 我可以在没有 css 的情况下更改标签的文本颜色吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13028132/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:31:30  来源:igfitidea点击:

Can i change the text color of a tag without css?

html

提问by caiocpricci2

I'm writing a template for an e-mail, and I can't use css. I need to change the color of the links, by default they get blue and underline. I want to keep the underline but change the color to black. Is that even possible without css?

我正在为电子邮件编写模板,但我无法使用 css。我需要更改链接的颜色,默认情况下它们会变成蓝色和下划线。我想保留下划线但将颜色更改为黑色。没有css甚至可能吗?

My exact line is:

我的确切线路是:

<tr><td><a href="#"> Link 3 </a></td></tr>

EDIT

编辑

I found this answerbut it adds an attribute to the body section. That's also something I can't have. Any other solutions?

我找到了这个答案,但它为正文部分添加了一个属性。这也是我不能拥有的。还有其他解决方案吗?

<body link="XXX" alink="YYY" vlink="ZZZ">

EDIT

编辑

This linkis great if like me you have to write html for an email. I'm copying it here for posterity. Thanks @Andy.

如果像我一样必须为电子邮件编写 html,则此链接非常有用。我把它复制到这里供后代使用。谢谢@安迪。

回答by jangxx

What you could do is use the old and deprecated font tag. So it would be:

您可以做的是使用旧的和已弃用的字体标签。所以它会是:

<tr><td><a href="#"><font color="black"> Link 3 </font></a></td></tr>

回答by pkachhia

Use below code:

使用以下代码:

<tr><td><a href="#" style="color:black;"> Link 3 </a></td></tr>

it is an inline CSS and as per your requirement you can use it into your email.

它是一个内联 CSS,根据您的要求,您可以在电子邮件中使用它。

回答by Advik

The only way to do this in PURE HTML is to use linkand vlinkattributes.

在纯 HTML 中执行此操作的唯一方法是使用链接vlink属性。

<body link='black' vlink='black'>
        <a href='#'>Click Me</a>
</body>

Here, linkis a unvisited hyperlink and vlinkis a visited hyperlink.

这里,link是未访问的超链接,vlink是访问过的超链接。

To change color on hover use alink(active link) attribute of the body tag :

要在悬停时更改颜色,请使用body 标签的alink(活动链接)属性:

<body link='black' vlink='black' alink='green'>
    <a href='#'>Click Me</a>
</body>

In the above code the color of the link changes to green whenever you hover the link.

在上面的代码中,只要您将鼠标悬停在链接上,链接的颜色就会变为绿色。

HOPE This Helped You!

希望这对你有帮助!