Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a simple html page. When I view this page using Internet Explorer 8, it shows also style. But when I view it using Google Chrome or Firefox, style does not appear. Can you help me why ? What am I doing wrong ?

HTML File:
<html>
<head>
HEAD SECTION
<!--<link type="text/css" href="txt.css" rel="stylesheet"/>-->
<style type="text/css">
 @import url("txt.css");
</style>
</head>

<body>
<div class="clsverdana">Html new starts here...</div>
<div id ="divId">Html new ends here...</div>
</body>
</html>


CSS File:
CSS
.clsverdana
{
 font-family = verdana;
 font-size = 16;
 font-weight = bold;
 color = orange;
}

#divId
{
 font-family=Tahoma;
 font-size= 16;
 font-weight = bold;
 color = purple;
}

body
{
 background-color=blue;
}
Posted
Updated 1-Jan-11 3:37am
v2
Comments
thatraja 1-Jan-11 9:37am    
Added code block & trimmed
Manfred Rudolf Bihy 1-Jan-11 9:57am    
Your style sheet was not in the correct format. See my updated answer.
Now it works in FireFox and IE8.

1 solution

Don't use the style tag and "@import" it isn't supported in FireFox use this inside the <<head>> tag:

XML
<head>
...
<link rel="stylesheet" media="screen" href="corporate-screen.css" type="text/css"/>
...
</head>


CSS
.clsverdana
{
    font-family: verdana;
    font-size: 16px;
    font-weight: bold;
    color: orange;
}

#divId
{
    font-family: Tahoma;
    font-size: 16px;
    font-weight: bold;
    color: purple;
}

body
{
    background-color: blue;
}



For a complete reference on inserting external stylesheets in HTML please visit here:

http://www.w3.org/TR/html4/present/styles.html#h-14.3[^]

Best Regards,

Manfred
 
Share this answer
 
v6
Comments
Close Network 1-Jan-11 9:08am    
I have changed but style does not still appear.
Valery Possoz 1-Jan-11 11:20am    
Did you change your css as well? Note that the "=" signs have been replaced by ":".
If you apply both changes it works very well. ie the ":" in the css and <link> instead of <style>.
I vote 5 for Manfred solution.
Manfred Rudolf Bihy 1-Jan-11 11:25am    
Thanks, Valery! I spotted that with the "=" at second glance. The first version of my answer had not yet included the corrected stylesheet. :)
Close Network 1-Jan-11 11:32am    
Thanks. I replaced = with :. It works now.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900