Help - Search - Members - Calendar
Full Version: external .css not showing up
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
DaneClark
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style type="text/css">
body {
color: purple;
background-color: #d8da3d }
</style>
<center>
I hope I'm doing this right
<link rel="stylesheet" href"main header.css" type "text/css" />
<title>
Module 5 assignment
</title>
<style type="text/css">
</style>
</head>
<body>
<font size="+2" face="Times"color="red">
<CENTER>
This is the toughest project we've done so far
</CENTER>
</font>
<font size="+3" face="Comic Sans MS"color="green">
<CENTER>
This is the toughest project we've done so far
</CENTER>
</font>
<LINK REL=StyleSheet HREF="body1.css" TYPE="text/css" MEDIA=screen>
<p class="right">
Some people are about to be run over. Frankie has about 5 seconds. Some people are very
tall and merciless. Quincy is destroying San Antonio. Some people wears glasses. Beth
looks like a dude. Some people are squirrel-handed. Gregor is a weird name. Some people
have braces. Some people have headgear. Fran could play linebacker for the Raiders. Some
people have rigged the enemy base with explosives. Albert has. Some people have a Southern
accent, and those are hot. Trisha is a severe hottie. Some people are being fangoriously
devoured by a gelatinous monster. Hillary's legs are being digested. Everyone is different.
No two people are not on fire.
</p>


The content of the .css is:

.one {border-top: thick dotted black;
border-right: thick solid blue;
border-bottom: thick groove red;
border-left; thick double #000; }


What am I doing wrong?
pandy
This. smile.gif
<link rel="stylesheet" href"main header.css" type "text/css" />

The equal sign is missing + spaces in URLs must be URL encoded.
http://www.blooberry.com/indexdot/html/top...urlencoding.htm

There equal sign for 'type' is also missing. Also, the end slash is a XHTML thing and should absolutely not be used in HTML. Not a show stopper, but anyway.

CODE
<link rel="stylesheet" href="main%20header.css" type="text/css">


If it still doesn't work, please post the URL to the page.

Another thing, since you use CSS you are better off with a doctype that triggers Standards Mode. See http://hsivonen.iki.fi/doctype/ .
DaneClark
That still didn't work. By the way, the first .css link wasn't supposed to be there and was left over from something earlier, it's the second one I was talking about. Anyway, here's how it looks now:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style type="text/css">
body {
color: purple;
background-color: #d8da3d }
</style>
<center>
I hope I'm doing this right
<title>
Module 5 assignment
</title>
<style type="text/css">
</style>
</head>
<body>
<font size="+2" face="Times"color="red">
<CENTER>
This is the toughest project we've done so far
</CENTER>
</font>
<font size="+3" face="Comic Sans MS"color="green">
<CENTER>
This is the toughest project we've done so far
</CENTER>
</font>
<link rel="stylesheet" href="body1.css" type="text/css">
<p class="right">
Some people are about to be run over. Frankie has about 5 seconds. Some people are very
tall and merciless. Quincy is destroying San Antonio. Some people wears glasses. Beth
looks like a dude. Some people are squirrel-handed. Gregor is a weird name. Some people
have braces. Some people have headgear. Fran could play linebacker for the Raiders. Some
people have rigged the enemy base with explosives. Albert has. Some people have a Southern
accent, and those are hot. Trisha is a severe hottie. Some people are being fangoriously
devoured by a gelatinous monster. Hillary's legs are being digested. Everyone is different.
No two people are not on fire.
</p>



pandy
LINK belongs in HEAD, not in BODY.
http://htmlhelp.com/tools/validator/

As said...
QUOTE(pandy @ Jul 23 2009, 09:30 PM) *

If it still doesn't work, please post the URL to the page.

Frederiek
See also http://htmlhelp.com/reference/css/style-html.html.
DaneClark
QUOTE(pandy @ Jul 23 2009, 05:42 PM) *

LINK belongs in HEAD, not in BODY.
http://htmlhelp.com/tools/validator/

As said...
QUOTE(pandy @ Jul 23 2009, 09:30 PM) *

If it still doesn't work, please post the URL to the page.



Where in the head? I put it just before <center> and it still wouldn't work
pandy
CENTER shouldn't be in HEAD either, as the validator would have told you.

HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>

<title>Module 5 assignment</title>

<LINK REL=StyleSheet HREF="body1.css" TYPE="text/css" MEDIA=screen>

<style type="text/css">
body {
color: purple;
background-color: #d8da3d }
</style>

</head>


<body>
<center>
I hope I'm doing this right
</center>

<!-- And so forth.... -->

</body>
</html>



That's not likely to be the reason why your style sheet doesn't work though, so can you please link to the page? I didn't ask you to out of curiosity.
Darin McGrew
See also Structure of an HTML 4 Document in our HTML reference.
DaneClark
I can't link to it because I haven't published it yet. Anyway, here's now it looks now. Still don't see the CSS border that's supposed to be there.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Module 5 assignment</title>
<LINK REL=StyleSheet HREF="body1.css" TYPE="text/css" MEDIA=screen>
<style type="text/css">
body {
color: purple;
background-color: #d8da3d }
</style>
</head>
<body>
<center>
I hope I'm doing this right
</center>
<font size="+2" face="Times"color="red">
<CENTER>
This is the toughest project we've done so far
</CENTER>
</font>
<font size="+3" face="Comic Sans MS"color="green">
<CENTER>
This is the toughest project we've done so far
</CENTER>
</font>
<p class="right">
Some people are about to be run over. Frankie has about 5 seconds. Some people are very
tall and merciless. Quincy is destroying San Antonio. Some people wears glasses. Beth
looks like a dude. Some people are squirrel-handed. Gregor is a weird name. Some people
have braces. Some people have headgear. Fran could play linebacker for the Raiders. Some
people have rigged the enemy base with explosives. Albert has. Some people have a Southern
accent, and those are hot. Trisha is a severe hottie. Some people are being fangoriously
devoured by a gelatinous monster. Hillary's legs are being digested. Everyone is different.
No two people are not on fire.
</p>








pandy
So let us at least see body1.css.
Darin McGrew
The validator (see the links at the top and bottom of this page) will show the structural errors in your markup.
DaneClark
Body1.css:

.one {border-top: thick dotted black;
border-right: thick solid blue;
border-bottom: thick groove red;
border-left; thick double #000; }
pandy
You dont have a class called "one" in the HTML.
DaneClark
QUOTE(pandy @ Jul 26 2009, 03:19 PM) *

You dont have a class called "one" in the HTML.


I don't know anything about classes. How do I put one in?
pandy
Begin here. Read the first 3 sections.
http://htmlhelp.com/reference/css/
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.