1.

Solve : Accessing external css file?

Answer»

My html document on the page is:-

<HTML>
<HEAD>
<TITLE>HOW DO YOU DO THAT</TITLE>
<link HREF="creating.css" rel="stylesheet" TYPE="text/css">

<body>
<span class="headlines">Welcome</span>


<div class="sublines">
This is the paragraph
</div>

<table border="2"><tr><td class="sublines">
This is the second paragraph
</td></tr></table>



This is the footer


[/color]


The external css file (creating.css) is:-

body {
.headlines, .sublines, infotext {font-face:arial; font-weight:bold;}
.headlines {font-size:14pt; COLOR:RED; background:yellow;}
.sublines {font-size:12pt; COLOR:GREEN; background:red;}
.infotext {font-size: 10pt; COLOR:BLUE; background:yellow;}
}



The page is showing properly in internet explorer,
but not in FIREFOX or opera.

i.e. in these two browsers i am not getting any color
or font size that i have mentioned in the CSS file.

What have I done wrong?Some codes ALWAYS does not do same thing different browser. it would be better to visit the url of w3c. Hope it make u transparent.

copy this URL: http://w3c.orgYou have the CSS file formatted wrong. You cannot place element classes inside the body class.

Try this:

Code: [Select].headlines, .sublines, .infotext
{
font-face:arial;
font-weight:bold;
}

.headlines
{
font-size:14pt;
COLOR:RED;
background:yellow;
}

.sublines
{
font-size:12pt;
COLOR:GREEN;
background:red;
}

.infotext
{
font-size: 10pt;
COLOR:BLUE;
background:yellow;
}
Quote from: kpac on December 31, 2008, 05:52:29 AM

You have the CSS file formatted wrong. You cannot place element classes inside the body class.

Try this:

Code: [Select].headlines, .sublines, .infotext
{
font-face:arial;
font-weight:bold;
}

.headlines
{
font-size:14pt;
COLOR:RED;
background:yellow;
}

.sublines
{
font-size:12pt;
COLOR:GREEN;
background:red;
}

.infotext
{
font-size: 10pt;
COLOR:BLUE;
background:yellow;
}


It worked. Good.


Discussion

No Comment Found