Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Want underline on hyperlink in one place, with none in others

Status
Not open for further replies.

jwhite68

IS-IT--Management
Jun 14, 2007
77
BG
Help! Before I kill the creator of css!!

I have a simple web page, and all I want to do is ensure the hyperlink is underlined. A css file that I import, has an entry which sets the underline to none by default.

I just want to ensure for one section of this web page, that the underline is on for hyperlinks.

Please see sample code below which is just my way to highlight the principle of the issue:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd">[/URL]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {
	font-family: "Times New Roman", Times, serif;
	font-style: italic;
}
.thetitle a{
    text-decoration:none !important;
}
-->
</style>
</head>

<body>
<div id="thetitle"><td width="42%" align="left" bgcolor="#F0F9ED"><a href="[URL unfurl="true"]http://www.abc.com/test.html"[/URL] target="_blank"><strong><font color="#0000CC"  face="Verdana" size="2">Empty space highlights speed of downturn</font></strong></a> &nbsp;</td></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>

What I did was put a div around the section, and called the div class "thetitle". Some inline css then tries to set this div classes a property to none. However, when you run this, it still shows underlined.

So how would you just force this div class's a href to have the underline set to none?

Since in my ACTUAL code (not the sample above) I have a css file that sets the following:

Code:
a{
	text-decoration: none;
	color: #498C23;
}

I cannot simply change my inline css to say

Code:
a{
  text-decoration:underline;
}

Because that would change it everywhere. And I only want underlined hyperlink in the a href within the div class.

Hope someone can stop me from going mad on this one!

Thanks, Jon
 
Hey yes, that works!

Please explain why I need the # instead of the . as a prefix for thetitle.

If you know!

Thanks Jon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top