472,119 Members | 1,472 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

css file won't link to xhtml

I am trying to read xhtml spec and use one of its examples about css2 in
xhtml.

The example on the PDF paper with internal styles defenition works just
fine. When I try to use an external file with css defs it just does not work
unless I use <link rel...> in the <header>. However, this is not how the
xhtml examples link style sheets and I would like to know the reason why it
is not working for me.

Here is the html file:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="styles.css" type="text/css"?>
<!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>
<link rel="stylesheet" href="styles.css" type="text/css" />
<title>Home page.</title>
</head>
<body>
<hehe>this needs to turn green before I go home</hehe>
</body>
</html>

and here is the CSS file:

hehe {
color: red;
font-family: monospace;
font-weight: normal;
}

What is wrong, can someone tell me please?

Jul 24 '05 #1
4 4037
Alexander Bolotnov wrote:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <hehe>this needs to turn green before I go home</hehe> What is wrong, can someone tell me please?


The Doctype you specified doesn't include a "hehe" element.

What content type are you serving the file with?

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 24 '05 #2
On Wed, 20 Apr 2005 21:15:36 +0200, "Alexander Bolotnov"
<do**@yandex.ru> wrote:
I am trying to read xhtml spec and use one of its examples about css2 in
xhtml.
Which XHTML Spec ?
URL ?
The example on the PDF paper Which PDF Paper ?
URL ?
When I try to use an external file with css defs it just does not work
unless I use <link rel...> in the <header>. Do I understand this right ?
The example you quote _is_ working. You have another example that links
to "an external file with css defs" that doesn't work. What does this
broken example look like ?
What is wrong, can someone tell me please?


No - I don't know what is wrong, so I can't tell you why it is not
working.

For me, I have the styles applied and it appears to "work". Give us the
URL of your server and we can look at your example that isn't working.

There is no "hehe" element in XHTML. Use either <span class="hehe" >
and .hehe {} (which works in all HTML versions) Or else use
namespacing, but that's not usually a good idea.

Jul 24 '05 #3
In article <42***********************@authen.white.readfreene ws.net>,
"Alexander Bolotnov" <do**@yandex.ru> wrote:
<?xml-stylesheet href="styles.css" type="text/css"?>


The PI only works for real XML--not text/html.

--
Henri Sivonen
hs******@iki.fi
http://hsivonen.iki.fi/
Mozilla Web Author FAQ: http://mozilla.org/docs/web-developer/faq.html
Jul 24 '05 #4
"Andy Dingley" <di*****@codesmiths.com> wrote in message
news:gh********************************@4ax.com...
When I try to use an external file with css defs it just does not work
unless I use <link rel...> in the <header>. Do I understand this right ?

The example you quote _is_ working. You have another example that links
to "an external file with css defs" that doesn't work. What does this
broken example look like ?
This example works as long as it has the <link rel=""> to stylesheet in the
header.
There is no "hehe" element in XHTML. Use either <span class="hehe" >
and .hehe {} (which works in all HTML versions) Or else use
namespacing, but that's not usually a good idea.


I kind of figured this out - if I serve the file as xml type from httpd then
it works. If I open it with my brower as an html page. It does not.

Thanks to all.

the papers and specs I am reading some from www.w3c.org
Jul 24 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Zhang Weiwu | last post: by
6 posts views Thread by rony_16 | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.