English 中文(简体)
how can i make different html links different colors . .
原标题:

I am generating a html file with many different links and they (by default) all show up the regular blue color. Is there anyway i can make certain links different colors. note that this html is getting pushed into outlook as an email so i can t have separate css files.

最佳回答

You can put your css in the <head/> of the <html>. Style your links with the color(s) you want. If you need more than one type of link, use classes. e.g.

a { color: #abcde1}
a.visited, a.hover {color: #1abcde;}

a.special {color:#123456;}
问题回答

use a css style for the anchor inline:

<a href="foo" style="color:orange"....

There are a couple different ways. CSS can appear in your head tag, so it doesn t have to be a separate style sheet.

One is to use the style attribute:

<a style="color:blue;">...</a>

Another is to use css classes:

<style>
.navLink { color: blue; }
</style>

<a class="navLink">...</a>

There are lots of options. See http://www.echoecho.com/csslinks.htm

You can use classes for your styles:

your CSS file:

.redlinks a
{
   color: #FF0000;
}

.greenlinks a
{
   color: #00FF00;
}

your HTML file:

<div class="redlinks"><a href="#">my link</a></div>

you could use internal style sheet or inline styles assuming the email client doesn t ignore them. of course by messing with link colours you run the risk of users not realising that you have links at all, so be careful.

This is example use of different colours for links:

<style type="text/css">
a.yellowLink { color:#ff0; }
a.greenLink { color:#0f0; }
a.redBlueLink { color:#f00; }
a.redBlueLink:hover { color:#00f; }
</style>

<a href="http://www.google.com/" class="yellowLink">I’m yellow</a>
<a href="http://www.google.com/" class="greenLink">I’m green</a>
<a href="http://www.google.com/" class="redBlueLink">I’m red and blue on hover</a>




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签