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

WBOY
Release: 2021-11-12 17:21:20
Original
36384 people have browsed it

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:颜色'
Copy after login

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>
Copy after login

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>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!