How do I create multicolor links in HTML?

Question

How do I create multicolor links in HTML?

Answer

There are a few different ways of doing this, for anyone interested in doing this the proper way we suggest using the first code, since the font tag is a deprecated tag.

Solution one using

Code

The first and proper method of doing this would be to use CSS to define your color and then use them later in the actual like. In the below code example, you would place the below CSS code into the <HEAD> portion of your web page. This defines the two color names and colors using HTML color codes.

<style type="text/css">
.blue {color: #00f;}
.green {color: #008000;}
</style>

Next, is the actual link containing span tags that used the above CSS defined colors within the link.

<a href="index.htm"><span class="green">Computer</span> <span class="blue">Hope</span></a>

Example

Computer Hope

Solution two using the HTML font tag

Code

<a href="index.htm"><font color="green">Computer</font> <font color="blue">Hope</font></a>

Example

Computer Hope

  • Category
  • HTML Q&A
  • Related pages
  • HTML Help
  • Solved?
  • Were you able to locate the answer to your question?