Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > CSS inlusion does not work

Reply
Thread Tools

CSS inlusion does not work

 
 
John Smith
Guest
Posts: n/a
 
      02-17-2004
I had a similar problem,
I solved this by changing the order of the attributes.

Try this:
<link rel="stylesheet" type="text/css" href="main.css">

Why or how don't ask me the only way I figured this out was that some of my
pages worked and others didn't and this was the difference!


"Matthias Pospiech" <(E-Mail Removed)> schreef in bericht
news:c0sj1s$j36$04$(E-Mail Removed)-online.com...
> IF I try to set style settings inside a file they are not recognised, only
> if they are directly inside to main html file.
> Here an example: The body settings for Font are only used if inside the

main
> file, not if inside the css file:
>
> <html>
> <!------------------------------ HEAD ---------------->
> <head>
> <title>Matthias Pospiech</title>
> <link href="main.css" rel="stylesheet" type="text/css">
> <style type="text/css">
> </style>
> </head>
>
> <!------------------------------ BODY ---------------->
> <body>
> Text
> </body>
> </html>
>
>
> // CSS - Style: Main Settings
>
> body {
> font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
> font-size : 100%;
> background-color : #FFFFFF;
> color : #000000;
> margin: 0px 0px 0px 0px;
> padding:0px;
> }
>
> This means that I cannot use style sheet files ! I tried in Opera and
> Mozilla.
>
> Matthias Pospiech
>



 
Reply With Quote
 
 
 
 
Matthias Gutfeldt
Guest
Posts: n/a
 
      02-17-2004
Matthias Pospiech wrote:
> IF I try to set style settings inside a file they are not recognised, only
> if they are directly inside to main html file.
>
> <link href="main.css" rel="stylesheet" type="text/css">


What's the URL so we can see what you're really doing?
Are you sure the HREF attribute points to the correct folder and file?
Does the server send the correct MIME type for the stylesheet?


Matthias

 
Reply With Quote
 
 
 
 
Matthias Pospiech
Guest
Posts: n/a
 
      02-17-2004
IF I try to set style settings inside a file they are not recognised, only
if they are directly inside to main html file.
Here an example: The body settings for Font are only used if inside the main
file, not if inside the css file:

<html>
<!------------------------------ HEAD ---------------->
<head>
<title>Matthias Pospiech</title>
<link href="main.css" rel="stylesheet" type="text/css">
<style type="text/css">
</style>
</head>

<!------------------------------ BODY ---------------->
<body>
Text
</body>
</html>


// CSS - Style: Main Settings

body {
font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
font-size : 100%;
background-color : #FFFFFF;
color : #000000;
margin: 0px 0px 0px 0px;
padding:0px;
}

This means that I cannot use style sheet files ! I tried in Opera and
Mozilla.

Matthias Pospiech

 
Reply With Quote
 
rf
Guest
Posts: n/a
 
      02-17-2004

"Matthias Pospiech" <(E-Mail Removed)> wrote in message
news:c0sj1s$j36$04$(E-Mail Removed)-online.com...
> IF I try to set style settings inside a file they are not recognised, only
> if they are directly inside to main html file.
> Here an example: The body settings for Font are only used if inside the

main
> file, not if inside the css file:


<snip code>

As usual a URL is essential. Copy/pasted stuff *always* looses something
vital.

I'll just be you have this as the first line of your CSS file:

<style type="text/css">

Cheers
Richard.


 
Reply With Quote
 
Barry Pearson
Guest
Posts: n/a
 
      02-17-2004
Matthias Pospiech wrote:
> Matthias Gutfeldt wrote:

[snip]
>> Does the server send the correct MIME type for the stylesheet?

> How can I check that ?

[snip]

This is useful - put the URL of the CSS in:
http://web-sniffer.net/

--
Barry Pearson
http://www.Barry.Pearson.name/photography/
http://www.BirdsAndAnimals.info/
http://www.ChildSupportAnalysis.co.uk/


 
Reply With Quote
 
Matthias Pospiech
Guest
Posts: n/a
 
      02-17-2004
Matthias Gutfeldt wrote:

> Matthias Pospiech wrote:
>> IF I try to set style settings inside a file they are not recognised,
>> only if they are directly inside to main html file.
> >
>> <link href="main.css" rel="stylesheet" type="text/css">

>
> What's the URL so we can see what you're really doing?

Its locally on my computer.
> Are you sure the HREF attribute points to the correct folder and file?

Yes, if I include the .container (see below) and set the text inside a <div
class="container"> it works
> Does the server send the correct MIME type for the stylesheet?

How can I check that ?

Matthias


-------------------------------------
..container {
width: 700px;
border: 0px solid gray;
margin: 0px;
margin-left: auto;
margin-right: auto;
padding: 0px;
background-color : #F0F0F0;
}

 
Reply With Quote
 
Matthias Pospiech
Guest
Posts: n/a
 
      02-17-2004
John Smith wrote:

> I had a similar problem,
> I solved this by changing the order of the attributes.
>
> Try this:
> <link rel="stylesheet" type="text/css" href="main.css">
>
> Why or how don't ask me the only way I figured this out was that some of
> my pages worked and others didn't and this was the difference!


It does not make a difference.

Matthias
 
Reply With Quote
 
SteW
Guest
Posts: n/a
 
      02-17-2004
Matthias Pospiech wrote:
> IF I try to set style settings inside a file they are not recognised, only
> if they are directly inside to main html file.
> Here an example: The body settings for Font are only used if inside the main
> file, not if inside the css file:
>
> <html>
> <!------------------------------ HEAD ---------------->
> <head>
> <title>Matthias Pospiech</title>
> <link href="main.css" rel="stylesheet" type="text/css">
> <style type="text/css">
> </style>
> </head>
>
> <!------------------------------ BODY ---------------->
> <body>
> Text
> </body>
> </html>


> Matthias Pospiech
>


It is the hyphens in your comments that are the problem.
Remove the hyphens from inside all comments and your stylesheet will work.
For example
<!-- ************* HEAD ************* -->

Actually it is consecutive hyphens -- that are causing the problem, so
<!-- - - - - - BODY - - - - - -->
would be ok too.

Ste W

 
Reply With Quote
 
Beauregard T. Shagnasty
Guest
Posts: n/a
 
      02-17-2004
Quoth the raven named Matthias Pospiech:

> body {
> font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
> font-size : 100%;


While we're examining your style sheet, consider this. Verdana is a
poor choice of font. I'd recommend using only Arial, Helvetica,
sans-serif;

http://www.xs4all.nl/~sbpoley/webmatters/verdana.html

Your choice of size at 100% is perfect, though.

--
-bts
-This space intentionally left blank.
 
Reply With Quote
 
Chet
Guest
Posts: n/a
 
      02-17-2004

"Matthias Pospiech" <(E-Mail Removed)> wrote in message
news:c0sj1s$j36$04$(E-Mail Removed)-online.com...
| IF I try to set style settings inside a file they are not
recognised, only
| if they are directly inside to main html file.
| Here an example: The body settings for Font are only used if
inside the main
| file, not if inside the css file:
|
| <html>
| <!------------------------------ HEAD ---------------->
| <head>
| <title>Matthias Pospiech</title>
| <link href="main.css" rel="stylesheet" type="text/css">
| <style type="text/css">
| </style>
| </head>
|
| <!------------------------------ BODY ---------------->
| <body>
| Text
| </body>
| </html>
|
|
| // CSS - Style: Main Settings
|
| body {
| font-family: Verdana, Geneva, Lucida, Arial, Helvetica,
sans-serif;
| font-size : 100%;
| background-color : #FFFFFF;
| color : #000000;
| margin: 0px 0px 0px 0px;
| padding:0px;
| }
|
| This means that I cannot use style sheet files ! I tried in
Opera and
| Mozilla.
|
| Matthias Pospiech
|

In the head remove

<style type="text/css">
</style>

This may be overriding the external css since it is empty. Just a
thought...

hth
--
Chet
http://www.velocityreviews.com/forums/(E-Mail Removed) (remove NO.....SPAM)


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
document.all["something"].SetAttribute("HREF", "stylesheet.css",0) does not work RC Javascript 0 10-03-2006 07:55 AM
XML/CSS - using column-span does not work ricky XML 2 12-28-2005 09:42 PM
Macromedia's css dynamic repositioning does not work in Netscape Kor Javascript 6 05-17-2004 08:01 AM
Webservice works once and then DOES NOT seem to work even though program does not crash Phi! ASP .Net Web Services 1 04-23-2004 08:42 AM
CSS does not work on HTML email on Modzilla Mail Ukiharappa HTML 3 10-08-2003 06:19 PM



Advertisments