Strange css problem (bug?)

M

M O J O

Hi,

I'm developing a asp.net application and ran into a strange css problem.

I want all my links to have a dashed underline and when they are
hovered, it must change to a solid line. Sounds simple, but it's not
working.

I've cooked down my output code to show you what I mean. If you run the
code below, there's no line under the link, but if you either remove the
<!DOCTYPE...> line or the body-part of the css decleration, everything
works fine.

Here's my code (watch for wrappings):

----------------------------------------------------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Strange</title>
<style>
<!--
body
{
font-family: verdana, arial, helvetica, sans-serif;
}


a:link, a:visited
{
font-family: verdana, arial, helvetica, sans-serif;
color: #d32525;
border-bottom: 1px dashed #d32525;
text-decoration: none;
}

a:hover
{
font-family: verdana, arial, helvetica, sans-serif;
color: #d32525;
border-bottom: 1px solid #d32525;
text-decoration: none;
}
-->
</style>
</head>

<body>
<a href="http://www.microsoft.com/">This is just a link</a>
</body>

</html>

----------------------------------------------------------------------

Any idea???????

I also found out, if I put a <p>&nbsp;</p> below the <a href...> in the
code above, everything works fine.

I'm confused!!!!!

HHHHEEELLLPPPPP! :eek:)

Thank you in advance.

M O J O
 
T

tom pester

Check out the css newsgroup

Let me know if you have any more questions...

Cheers,
Tom Pester
 
S

Stefan

Try putting your style-block before the body tag. Inside the head you
should only refer to external css files.
 
M

M O J O

Hi Stefan,

Thanks for letting me know. Unfortunately it does not solve my problem.

:eek:(

Hmmmmm.

Thanks anyway.

M O J O
 
B

Bruce Barker

your problem is that an <a> is an inline element, not a block element, so it
does not have a border. normally you use the text-decoration to control
underlining, but there is no dashed version. you can try setting the display
style to block.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top