XHMTL and CSS Problem

M

Matthias Braun

Help!

I am writing a XHTML webpage. The W3 validator says that everything is
OK, but the CSS file is ignored.

<!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" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="en-us" />
<title>Portal login</title>
<link href="http://localhost/neu/portal.css" rel="stylesheet"
type="text/css" />
</head>
(...)

If I am removing the first two lines describing the DOCTYPE, everything
works fine, but the W3 validator gives a warning. Who could help?

Thanks,

Matthias
 
B

Beauregard T. Shagnasty

Matthias said:
I am writing a XHTML webpage.
Why?

The W3 validator says that everything is
OK, but the CSS file is ignored.

<link href="http://localhost/neu/portal.css" rel="stylesheet"
type="text/css" />

Is this on your home server, or your public web host?
If I am removing the first two lines describing the DOCTYPE,
everything works fine, but the W3 validator gives a warning. Who
could help?

What happens if you use the highly-recommended HTML 4.01 Strict ?

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

...removing those extra slashes, of course: />

http://tekrider.net/html/doctype.php
 
D

Doug Miller

Help!

I am writing a XHTML webpage. The W3 validator says that everything is
OK, but the CSS file is ignored.

<!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" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="en-us" />
<title>Portal login</title>
<link href="http://localhost/neu/portal.css" rel="stylesheet"
type="text/css" />
</head>
(...)

If I am removing the first two lines describing the DOCTYPE, everything
works fine, but the W3 validator gives a warning. Who could help?
Have you validated your stylesheet too?

http://jigsaw.w3.org/css-validator/
 
J

Jukka K. Korpela

Beauregard said:

I guess the common reason is that HTML 4.01 lacks some tools to shoot on
one's foot that XHTML kindly offers.
What happens if you use the highly-recommended HTML 4.01 Strict ?

Probably nothing particular in this case.

It sounds like the OP is using poorly written CSS, which is ignored by
standards-conforming browsers as required by CSS specifications but
"honored" in Quirks Mode, see
http://www.cs.tut.fi/~jkorpela/quirks-mode.html

The odds are that starting from scratch, after reading a decent tutorial in
web authoring, is _much_ easier than trying to fix the broken code.
 
M

Matthias Braun

Beauregard said:
Is this on your home server, or your public web host?
I am using XAMPP on my home server.
What happens if you use the highly-recommended HTML 4.01 Strict ?

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

..removing those extra slashes, of course: />

http://tekrider.net/html/doctype.php
This does not work, because the W3 validator
http://validator.w3.org/check reports that this is not a XHTML document.
Strange!

Matthias
 
J

Jukka K. Korpela

Matthias said:
I am using XAMPP on my home server.

Please read between the lines.

Upload your document on a public server and post the URL, if you want others
to help you.
 
J

Jonathan N. Little

Matthias said:
Help!

I am writing a XHTML webpage. The W3 validator says that everything is
OK, but the CSS file is ignored.

<!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" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="en-us" />
<title>Portal login</title>
<link href="http://localhost/neu/portal.css" rel="stylesheet"

Because the resource is *not* publicly accessible. "localhost" is not a
public domain.
 
C

C A Upsdell

Help!

I am writing a XHTML webpage. The W3 validator says that everything is
OK, but the CSS file is ignored.

<!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" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="en-us" />
<title>Portal login</title>
<link href="http://localhost/neu/portal.css" rel="stylesheet"
type="text/css" />
</head>
(...)

If I am removing the first two lines describing the DOCTYPE, everything
works fine, but the W3 validator gives a warning. Who could help?

Someone else had a similar problem a while back, and it turned out that
the server was not providing the correct MIME type for the CSS file:
some browsers, like FF, will ignore the CSS file if the MIME type is
wrong and a Strict DOCTYPE is used.
 
M

Matthias Braun

Yes, you are right. Posting it on a public server shows no problem. On
my host, only FF shows a problem, but not IE. So it seems to be an
Apache problem, not a HTML problem.

Now I will go through my Apache config to find the problem. Or who knows
more?

Matthias
 
R

richard

Because the resource is *not* publicly accessible. "localhost" is not a
public domain.

localhost may have been edited so as not to give a valid working link by
design. as he did say everything validated and worked fine from the server.
 
A

Andy Dingley

Help!

I am writing a XHTML webpage. The W3 validator says that everything is
OK, but the CSS file is ignored.

<!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" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="en-us" />
    <title>Portal login</title>
    <link href="http://localhost/neu/portal.css" rel="stylesheet"
type="text/css" />
</head>
(...)

This looks more like a HTTP problem than a HTML problem, i.e. your CSS
content isn't being delivered.

I suggest installing Firefox with the Live HTTP Headers extension.
Clear your cache, then attempt to load the page. The HTTP Response
headers should show HTTP 200 success codes for both the HTML & CSS
documents (also any images etc.) Also check the MIME types for these
documents.
 
J

Jonathan N. Little

Matthias said:
Yes, you are right. Posting it on a public server shows no problem. On
my host, only FF shows a problem, but not IE. So it seems to be an
[please stop top-posting]
Apache problem, not a HTML problem.

Now I will go through my Apache config to find the problem. Or who knows
more?

Long ago some servers where configured with .css link to
"application/x-pointplus" which was troublesome, but that was quite a
while ago, Apache 1.x. In your httpd.conf|apache2.conf or a sub-config
(my Ubuntu servers have an included mime.conf all depends on distro)
there is the the directive

TypesConfig /etc/mime.types

to your servers default mime definitions. Now the default should be
text/css for css. Of course for servers that you do not have direct
control one could always add

AddType text/css .css

in an .htaccess file.
 
M

Matthias Braun

Great, now it works!

I have had in the .htaccess the following lines (don't ask me why):

<FilesMatch "\.(css|style)$">
SetHandler application/x-httpd-php
</FilesMatch>

I removed the lines and - voila - problem has gone!

Thanks,

Matthias
Matthias said:
Yes, you are right. Posting it on a public server shows no problem. On
my host, only FF shows a problem, but not IE. So it seems to be an
[please stop top-posting]
Apache problem, not a HTML problem.

Now I will go through my Apache config to find the problem. Or who knows
more?

Long ago some servers where configured with .css link to
"application/x-pointplus" which was troublesome, but that was quite a
while ago, Apache 1.x. In your httpd.conf|apache2.conf or a sub-config
(my Ubuntu servers have an included mime.conf all depends on distro)
there is the the directive

TypesConfig /etc/mime.types

to your servers default mime definitions. Now the default should be
text/css for css. Of course for servers that you do not have direct
control one could always add

AddType text/css .css

in an .htaccess file.
 

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,982
Messages
2,570,186
Members
46,739
Latest member
Clint8040

Latest Threads

Top