CSS links – different formats

Posted on October 26, 2008 Categories: Search

post author

Written by: Jan

Jan is an eccentric Slovakian SEO wizard. When he's not researching search, optimising sites, building inbound links, or working on content creation, he's a part-time professor, teaching PHP to his students at university.


Using different CSS classes for links is quite easy, but many newbie webmasters don’t know what exactly to do. So they end up with using the font tag within the a tags, or they use span tags instead of going the easy (and correct) route. The solution is this:

Say that in the source code of your website (XHTML) you are going to link to web-developers.net, but you want to differentiate the link from all other links. To do this, you should use this:

<a href="http://www.web-developers.net" target="_blank" class="external_link_1">web-developers.net</a>


Of course, assume that the class external_link_1 has not yet been defined in the CSS file. Now, add these lines

a:link.external_link_1
{
color: #105286;
text-decoration: none;
}
a:active.external_link_1
{
color: #105286;
text-decoration: none;
}
a:visited.external_link_1
{
color: #105286;
text-decoration: none;
}
a:hover.external_link_1
{
color: Black;
text-decoration: underline;
}


This does the work for you. You can modify the layout of such links by adding/modifying the external_link_1 CSS class. Before I mention the most used CSS properties, make sure that your XHTML file links to the CSS file. This can be done by placing the following code between <head> and </head> tags:

<link rel="stylesheet" href="./style.css" type="text/css" />

The CSS properties I use most often for links are:

font-family, font-style, font-size, color, text-decoration. However, there are many more available than these. This link is particularly useful.

Sponsored links

Follow us:

Leave a Reply

Archive

July 2010

June 2010

May 2010

April 2010

March 2010

February 2010

January 2010

December 2009

November 2009

May 2009

April 2009

March 2009

February 2009

January 2009

December 2008

November 2008

October 2008

September 2008

July 2008

June 2008

March 2008

February 2008

January 2008

December 2007

November 2007

October 2007

About Us

A team of nerds, creatives and strategy ninjas based in central London, building websites, social networks, widgets and social media apps.

We have a portfolio that is good enough to make a male peacock blush, and some killer outside-the-box products...in a box.
Ask us a Question

Blog posts