Computer Hope

Internet & Networking => Web design => Topic started by: shouvik on December 30, 2008, 09:06:58 PM

Title: Accessing external css file
Post by: shouvik on December 30, 2008, 09:06:58 PM
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>


<div class="infotext">
This is the footer
</div>
</body>
</html>[/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?
Title: Re: Accessing external css file
Post by: xenium007 on December 31, 2008, 03:44:43 AM
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.org
Title: Re: Accessing external css file
Post by: 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;
}
Title: Re: Accessing external css file
Post by: shouvik on January 01, 2009, 11:52:52 PM
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. ;)
Title: Re: Accessing external css file
Post by: kpac on January 02, 2009, 05:13:42 AM
Good. :)