Login | Register | FAQ
Anonymous

External Style Sheet Doesn't Work

+ Post a reply

6 posts Page 1 of 1


External Style Sheet Doesn't Work

by Mastermind » Wed Jun 20, 2012 4:29 pm

I was experimenting with External style sheets, but I just couldn't get it to work. No matter what I did, I just couldn't use the style sheet properly. Whenever, I opened my site, it wouldn't show anything from the style sheet.
Here's my code for the site,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title> Extra Links </title>
<link rel="stylesheet" type="text/css" href="math.css" />
</head>
<body>
<h1> p </h1>
</body>
</html>
Here's the style sheet
h1 {font-color:blue;}

Hope you guys can help with this. Thanks!
User avatar

Mastermind

  • Posts: 5
  • Joined: Wed Jun 20, 2012 4:21 pm

Re: External Style Sheet Doesn't Work

by chrisf1288 » Wed Jun 20, 2012 7:06 pm

Well, is the stylesheet and HTML file in the same folder?
User avatar

chrisf1288

  • Posts: 128
  • Joined: Sun Jun 26, 2011 1:01 am

Re: External Style Sheet Doesn't Work

by Mastermind » Wed Jun 20, 2012 10:12 pm

the stylesheet and file are in the same folder , and to cubesquare's reply, i meant to write that any type of css in my stylesheets would fail namely font-size. Your example with color worked, but when i tried it with font-size, nothing happened. Thank you
User avatar

Mastermind

  • Posts: 5
  • Joined: Wed Jun 20, 2012 4:21 pm

Re: External Style Sheet Doesn't Work

by Mastermind » Thu Jun 21, 2012 3:59 pm

The problem is that the css works when it is embedded, but the ESS will not work.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title> Extra Links </title>
<style>
h1 {font-size: 60px; font-family: times new roman;}
h2 {font-size: 30px; font-family: times new roman;}
p {font-size: 15px; font-family: times new roman;}
</style>
</head>
<body>
<h1 style="position:absolute;top 0 px;left:450px;"><Font Color="blue"> Extra links <Font></h1>
</body>
</html>

This way works, but when i do this:
h1 {font-size: 100px; font-family: arial;}
and
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title> Extra Links </title>
<style>
<link rel="stylesheet" type="text/css" href="math.css">
</style>
</head>
<body>
<h1 style="position:absolute;top 0 px;left:450px;"><Font Color="blue"> Extra links <Font></h1>
</body>
</html>

It fails,
can you tell me where the error in syntax is, so i can fix it?
Thank you.
User avatar

Mastermind

  • Posts: 5
  • Joined: Wed Jun 20, 2012 4:21 pm

Re: External Style Sheet Doesn't Work

by Mastermind » Thu Jun 21, 2012 10:05 pm

Thanks CubeSquare for your help, i really appreciate it, but another problem came up, your stylesheet worked, but when i tried doing it with font-size, it failed, everything else worked. Do you know why font-size doesn't work.
Thanks
Mastermind
User avatar

Mastermind

  • Posts: 5
  • Joined: Wed Jun 20, 2012 4:21 pm

Re: External Style Sheet Doesn't Work

by Mastermind » Fri Jun 22, 2012 4:16 pm

Thanks CubeSquare!!!! It Finally worked!!!!!!!!!!!!!!!
Mastermind
User avatar

Mastermind

  • Posts: 5
  • Joined: Wed Jun 20, 2012 4:21 pm


+ Post a reply

Page 1 of 1

?>