Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Separate formatting for link text & link image?
Old 11-17-2003, 01:52 AM Separate formatting for link text & link image?
Average Talker

Posts: 21
Trades: 0
Hi, I have a Web page with a text link and an image link (clickable image). I want to use CSS to give the text link a dotted underline and I want the clickable image to have no formatting.

I tried using this style code:

Code:
a:link {
border-bottom: 1px dotted;
}
..but this gives both the text AND the image a dotted underline. I only want the text to have the dotted underline. So I tried this:

Code:
<html>
<head>
	<style>
		a:link {
			border-bottom: 1px dotted;
		}
		
		a img {
			border-bottom: 0px none;
		}
		
		a > img {
			border-bottom: 0px none;
		}
		
		a:link img {
			border-bottom: 0px none;
		}
		
		a:link > img {
			border-bottom: 0px none;
		}
		
		a + img {
			border-bottom: 0px none;
		}
	</style>
</head>

<body>

<tr valign="middle">
	<td align="center">
		<a href="link.html">
			<img src="thumb.jpg" width="60" height="60" border="1">
		</a>
	</td>
</tr>
<tr>
	<td align="center">
		<a href="link.html">
			<font size="1">
				Click here to find out more.
			</font>
		</a>
	</td>
</tr>				

</body>
</html>
I know that I've tried lots of different style selectors but I was hoping that one of them would work. Unfortunately not. I find that still both the text and image have a dotted underline.

Does anyone know how to solve this? Surely there must be a straightforward way without using classes?

Thx,

May
may_hem1 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-17-2003, 09:20 AM
techwench's Avatar
Code Monkey

Posts: 1,449
Name: Danalyn
Location: Dallas, TX
Trades: 0
Off the top of my head, all I can think of is setting up different classes for each like style..
Code:
a.text:link { border-bottom: 1px dotted; }
a.img:link { border-bottom: 0px none; }
And then:
Code:
<A CLASS="text" HREF="link.html">Click Here</A>

<A CLASS="img" HREF="anotherpage.html"><IMG SRC="image.gif"></A>
Either that, or set the BORDER attribute in your IMG tag to "0".
techwench is offline
Reply With Quote
View Public Profile
 
Old 11-21-2003, 08:14 AM
Average Talker

Posts: 21
Trades: 0
Thanks Prissed!

The separate classes worked.

I didn't use an image border of zero because I want the images to have a small border.

May
may_hem1 is offline
Reply With Quote
View Public Profile
 
Old 11-26-2003, 12:57 AM
Ultra Talker

Posts: 377
Trades: 0
You can also use an id - like "#pictured_link" or smth like that. Then use like <a href=... id="pictured_link">... It should work too.
__________________
andrews_john

Please login or register to view this content. Registration is FREE
andrews_john is offline
Reply With Quote
View Public Profile Visit andrews_john's homepage!
 
Reply     « Reply to Separate formatting for link text & link image?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.28349 seconds with 12 queries