Forum Moderators: not2easy

Message Too Old, No Replies

CSS problem with firefox--Newbie

         

hemant

11:42 am on May 9, 2007 (gmt 0)

10+ Year Member



my css(Noname4.css) :

<style type='text/css'>

a:link {
text-decoration: none;
background-color: transparent;
color: #003399;
}

a:visited {
text-decoration: none;
background-color: transparent;
color: #003399;
}

a:hover {
text-decoration: underline ;
background-color: transparent;
color: #003399;<!---#990000--->
}

a:active {
text-decoration: none;
background-color: transparent;
color: #666699;
}

</style>

my html file :

html>
<head>
<title>Test</title>
<link rel="stylesheet" type="text/css" href="Noname4.css">
</head>

<body>
<table width="191" border="0" cellpadding="0" cellspacing="0" align="left">
<tr>
<td align="left" valign="top">
<div class="forumline" style="width:191px;">
<div class="titlebar" style="width:191px;">NAVIGATION</div>
<div class="cat" style="width:191px;">Tutorials</div>
<div class="navcontainer">
<ul class="navlist">
<li><a href="#">Test</a></li>
<li><a href="#">Test</a></li>
<li><a href="#">Test</a></li>
<li><a href="#">Test</a></li>
<li><a href="#">Test</a></li>
</ul>
</div>
<div class="cat" style="width:191px;">Other Stuff</div>
<div class="navcontainer">
<ul class="navlist">
<li><a href="#">Test</a></li>
<li><a href="#">Test</a></li>
<li><a href="#">Test</a></li>
<li><a href="#">Test</a></li>
<li><a href="#">Test</a></li>
<li><a href="#">Test</a></li>
</ul>
</td>
</tr>
</table>
</body>
</html>

Now what I want is that if user rolls(not click) it's mouse over link it would come as underlined link...which is working fine in IE 7 but in FireFox 2.0.0.1 it is showing all links already underlined so no effect on rolling the mouse over the link.

I tried to validate my css, using validator (http://jigsaw.w3.org/css-validator/validator.html#validate-by-upload), it gives error :

Lexical error at line 1, column 2. Encountered: "s" (115), after : "<"

I m newbie please suggest me some solution.

thanks,
Hemant

Robin_reala

12:06 pm on May 9, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Hemant, and welcome to WebmasterWorld!

You don't need the <style> element in an external CSS file - the file should only contain CSS and no HTML. Remove those and you'll be fine.

penders

12:16 pm on May 9, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



<!---#990000--->

Also, along the same lines as Robin_reala, the above is an HTML comment and should be removed. Instead, for a CSS comment, you need:

/* #990000 */

hemant

12:18 pm on May 9, 2007 (gmt 0)

10+ Year Member



Thanks for response Robin and penders.

yes you are correct in this case but what if we are using style tags with some style-elements.

for eg : this css:

<style type='text/css'>

a:link {
text-decoration: none;
background-color: transparent;
color: #003399;
}

a:visited {
text-decoration: none;
background-color: transparent;
color: #003399;
}

a:hover {
text-decoration: underline ;
background-color: transparent;
color: #003399;
}

a:active {
text-decoration: none;
background-color: transparent;
color: #666699;
}

.AppCopyRightText {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: 333333;
text-decoration: none
}

</style>

now if we are removing style validator is not validating css and giving error:

32 .AppCopyRightText Value Error : color 333333 is not a color value : 333333

So what should i need to do in this case.

Thanks,
Hemant

Robin_reala

12:31 pm on May 9, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, that's a separate error. In CSS all hex colours should be prefixed with a '#' (like you've done with the colours earlier in your code).

[edited by: Robin_reala at 12:31 pm (utc) on May 9, 2007]

hemant

7:18 am on May 10, 2007 (gmt 0)

10+ Year Member



Thanks Robin and others, those replies were really helpful.

Regards,
Hemant