CSS inlusion does not work

J

John Smith

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!
 
M

Matthias Gutfeldt

Matthias said:
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
 
M

Matthias Pospiech

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
 
R

rf

Matthias Pospiech said:
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.
 
M

Matthias Pospiech

Matthias said:
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;
}
 
M

Matthias Pospiech

John said:
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
 
S

SteW

Matthias said:
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
 
C

Chet

| 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
 
B

Beauregard T. Shagnasty

Quoth the raven named Chet:
In the head remove

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

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

No, that won't have any effect, so long as it is typed correctly.
 
N

Neil Marshall

Matthias said:
Matthias Gutfeldt wrote:



How can I check that ?

In mozilla, if it's being served up as a text/plain it will put an error
in the JavaScript console. Also if you look at the page using mozilla
and go to page info, it will also tell you if it's text/plain or text/css
 
M

Matthias Pospiech

Beauregard said:
Quoth the raven named Matthias Pospiech:


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
I had read other article with contrary positions. Their reason why one
should use Verdana is that it is quite big even on computers with lower
font sizes, like Mac or Linux.
On the other hand I can follow the argument of this article. I will have to
think about it, but thats not what worries me now the most...

Matthias Pospiech
 
A

Andrew Urquhart

Matthias Pospiech said:
How can I check that ?

One quick way is to open the css file directly in Opera and hover over the
page tab, it appears in a tool-tip. In Firefox open the css file directly
and use the 'View Page Info" option in the 'right click' context menu, it's
displayed as "type" on the general tab.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top