Jump to content


Multiple Hyperlink Styles in CSS


2 replies to this topic

#1 pizzaboy

    Young Padawan

  • Members
  • Pip
  • 22 posts

Posted 19 May 2006 - 03:31 AM

I want to have a section of code which contains 2 different hyperlink styles.

My CSS:
.bodytext {font: 11px Arial, Helvetica, sans-serif;}
A {FONT-WEIGHT: bold; COLOR: #0c4978}

My HTML:
<td>
	<A href="http://www.mysite.com/maintopic">Main Topic</A><BR>
	<span class="bodytext"><A href="http://www.mysite.com/article" target=blank>Article</A></span>
	</td>

Topic Heading (Main hyperlink stlyle - A)
Article Reference (2nd. hyperlink style which is the same as the bodytext, but with an underline)


Both hyperlinks are on the same <td> tag. I've been playing around with the <span> tags and messing with the CSS, but nothing seems to work.

Can anyone help? :D


Thanks.

Edited by pizzaboy, 19 May 2006 - 03:43 AM.


#2 pizzaboy

    Young Padawan

  • Members
  • Pip
  • 22 posts

Posted 19 May 2006 - 05:06 AM

Many, many apologies.

The CSS does appear to work, it was just that the CSS styles were not modified to show the obvious changes.

Sorry. :blush:

#3 Jem

    Young Padawan

  • Members
  • Pip
  • 93 posts
  • Location:England
  • Interests:Photography, design &amp; developing, walking, cycling, reading.

Posted 19 May 2006 - 09:11 AM

I see you've got this resolved now, but can I make a suggestion anyway..? Instead of wrapping the links in spans and assigning a class to the span, which adds HTML and CSS to their respective pages thus increasing file sizes and bandwidth usage, why not just assign the class to the link? E.g:

<td>
	<a href="http://www.mysite.com/maintopic">Main Topic</a><br>
	<a href="http://www.mysite.com/article" target="_blank" class="bodytext">Article</a>
	</td>

..and then customising it with CSS like so:

a.bodytext {
css stuff: here;
}

It'd be more efficient, and more semantically correct :blush:





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users