mcfly soft
mcfly soft

Reputation: 11645

Howto have different colors on links in a Android Webview

I would like to show different kind of links in a webview. Different links trigger different actions. To see what kind of link is present, I would like to color them differently (Or any other type of visual difference).

I know how to change the color of all links.

Is this possible and when yes how ?

Upvotes: 2

Views: 1115

Answers (1)

gio
gio

Reputation: 5020

From EchoEcho.com

Define colors for all links on the page

The general color of text links is specified in the tag, like in the example below:

<body link="#C0C0C0" vlink="#808080" alink="#FF0000">

link - standard link - to a page the visitor hasn't been to yet. (standard color is blue - #0000FF). vlink - visited link - to a page the visitor has been to before. (standard color is purple - #800080). alink - active link - the color of the link when the mouse is on it. (standard color is red - #FF0000).

Define colors for individual links on the page

The method described above is for setting overall link colors for the page.

However, you might want one or more links to have different colors than the rest of the page.

There are two methods for doing this: Placing font tags between the and the tag. This method will work on all browsers except MSIE 3.

Using a style setting in the tag. This method works on MSIE3 and newer browsers.

The first technique would look like this:

Click <a href="http://www.yahoo.com"><font color="FF00CC">here</font></a> to go to yahoo.

Note: It is important that both the and the tags are between the and tags.

The second technique would look like this:

Click <a href="http://www.yahoo.com" style="color: rgb(0,255,0)">here</a> to go to yahoo. 

Note: The RGB numbers indicate amounts of red, green, and blue using values between 0 and 255. You can read more about converting between RGB colors and hexadecimal colors here.

Now, since neither of the two methods covers all browsers, we need to use both techniques at once.

This example will work on all browsers:

Click <a href="http://www.yahoo.com" style="color: rgb(0,255,0)"><font color="FF00CC">here</font></a> to go to yahoo.

Upvotes: 1

Related Questions