.."; 2. Add the a tag to the font color. Add internal styles for modification, the syntax is "a{color:color value;}"."/> .."; 2. Add the a tag to the font color. Add internal styles for modification, the syntax is "a{color:color value;}".">

Home  >  Article  >  Web Front-end  >  How to set the font color of the a tag in html

How to set the font color of the a tag in html

WBOY
WBOYOriginal
2021-11-12 17:09:1636478browse

How to set the font color of the a tag in html: 1. Use the style attribute to add an inline style to the a tag for modification. The syntax is ".. a>"; 2. Add an internal style to the a tag to modify it, with the syntax "a{color: color value;}".

How to set the font color of the a tag in html

The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.

How to set the font color of the a tag in html

1. You can use the style attribute to modify the color of the a tag in html.

The code is as follows:

style='color:颜色'

Example:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <a href=&#39;www.php.cn&#39; style=&#39;color:red&#39;>这是一个a标签</a>
    <a href=&#39;www.php.cn&#39; style=&#39;color:black&#39;>这是一个a标签</a>
    <a href=&#39;www.php.cn&#39; >这是一个a标签</a>
</body>
</html>

Output result:

How to set the font color of the a tag in html

2. Passa{color: color value}Statement settings

The example is as follows:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<style type="text/css">
a{color:#FF0000}
    </style>
<body>
<a href="#" >这是一个a标签</a>
</body>
</html>

Output result:

How to set the font color of the a tag in html

For more programming-related knowledge, please visit: programming video! !

The above is the detailed content of How to set the font color of the a tag in html. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn