homepage Welcome to WebmasterWorld Guest from 54.166.8.138
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
css validation problem
document type does not allow element
jkruit




msg:572504
 1:24 pm on Jul 24, 2003 (gmt 0)

I have had to change my pages to .asp and now my CSS include page no longer works. Here are the errors I get

Line 28, column 22: document type does not allow element "STYLE" here (explain...).
<style type="text/css">
^
Line 153, column 62: document type does not allow element "LINK" here (explain...).
...link rel="stylesheet" type="text/css" href="texmed.css">

Could someone please tell me the correct way to write this?

Thanks
Janine

 

korkus2000




msg:572505
 2:53 pm on Jul 24, 2003 (gmt 0)

What dtd are you using? These are both nested in the head?

marek




msg:572506
 3:08 pm on Jul 24, 2003 (gmt 0)

Is the STYLE element a direct descendant of the HEAD, i.e.

<html>
<head>
...
<style ...>
</style
...
</head>
<body>
...
</body>
</html>

jkruit




msg:572507
 3:38 pm on Jul 24, 2003 (gmt 0)

Thanks for the quick replies.

When I did my web page in front page I put the css links in the head. I didn't change it went I changed the pages to .asp. Here is what the top of the page looks like. I tried to delete things that weren't relevant to the question.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="pragma" content="no-cache">
<meta name="MSSmartTagsPreventParsing" content="TRUE">
<meta name="ProgId" content="FrontPage.Editor.Document">
<link rel="stylesheet" type="text/css" href="_includes/texmed.css">

<style type="text/css">
<!--
/*dk blue links*/
a.bodytt:link {background-color: transparent;color: #003399;text-decoration: underline;font-weight: bold; font-size:80%}
a.bodytt:visited {background-color :transparent;color:#003399;text-decoration: underline;font-weight: bold; font-size:80%}
}
-->
</style>

</head>

<body><!--#include file = "_includes/toptest.inc"--><div align="center">

Thanks Janine

claus




msg:572508
 3:54 pm on Jul 24, 2003 (gmt 0)

Janine, the code you just posted does not re-create the errors you mentioned when putting it in a new document and taking it through the validator.w3.org.

/claus

choster




msg:572509
 4:05 pm on Jul 24, 2003 (gmt 0)

I hope this doesn't sound patronizing, but did you try clicking on the "(explain...)" links to see if they have anything helpful to say?

pageoneresults




msg:572510
 4:22 pm on Jul 24, 2003 (gmt 0)

Try removing the commented markup...

<style type="text/css">
<!--
/*dk blue links*/
a.bodytt:link {background-color: transparent;color: #003399;text-decoration: underline;font-weight: bold; font-size:80%}
a.bodytt:visited {background-color :transparent;color:#003399;text-decoration: underline;font-weight: bold; font-size:80%}
}
-->
</style>

Change to...

<style type="text/css">
/*dk blue links*/
a.bodytt:link {background-color: transparent;color: #003399;text-decoration: underline;font-weight: bold; font-size:80%}
a.bodytt:visited {background-color :transparent;color:#003399;text-decoration: underline;font-weight: bold; font-size:80%}
}
</style>

P.S. My other concern is what is between those lines. There is an error at line 28 and then it jumps to line 153. That is a lot of distance between two tags in the <head></head> section.

universalis




msg:572511
 5:35 pm on Jul 24, 2003 (gmt 0)

Quick question - are you missing a
<title> in the <head> section of your page, as in your example? That might mess things up...

Otherwise, it looks like an improperly nested tag problem - you may be missing a closing tag somewhere before the line where the first error occurs.

jkruit




msg:572512
 6:40 pm on Jul 24, 2003 (gmt 0)

Thanks for the help...I really don't have anywhere else to turn so please be patient with me.

Korkus2000 - I don't know what dtd is.

Marek - I don't know.

Claus - I recreated this in a new page and still got the same errors, so yes, it did recreate the error for me.

Choster - I did click on the error message but I don't know what it means. “document type does not allow element ‘FOO’ here; assuming missing ‘BAR’ start-tag’
Similar to the previous error, but more specific: in this case, you have a ‘FOO’ element that is not contained in a ‘BAR’ element when ‘FOO’ is not allowed outside of ‘BAR’. Some of the most common causes of this error are:

pageoneresults - I did what you suggested - no help.

universalis - I left the title tag off because I thought it was irrelevant. I can't find any missing tags.

Here is the webpage. Maybe you can look at the actual source code. <sorry, no example URLs>

Thanks
Janine

[edited by: tedster at 8:09 pm (utc) on July 24, 2003]

DrDoc




msg:572513
 7:16 pm on Jul 24, 2003 (gmt 0)

Do you have the <link> tag and <style> section in the head (and only in the head) section of the document, or is it in the body?

willybfriendly




msg:572514
 7:24 pm on Jul 24, 2003 (gmt 0)

You might want to edit out the link (See TOS)

You have the same markup in the head and in the body.

<body><link rel="stylesheet" type="text/css" href="_includes/texmed.css">
<style type="text/css">
<!--
/*dk blue links*/
a.bodytt:link {background-color: transparent;color: #003399;text-decoration: underline;font-weight: bold; font-size:80%}
a.bodytt:visited {background-color :transparent;color:#003399;text-decoration: underline;font-weight: bold; font-size:80%}
}
-->
</style>

I would try taking out that code in the body element

WBF

<edit>Oops, hit submit before I was done responding<edit>

[edited by: willybfriendly at 7:41 pm (utc) on July 24, 2003]

pageoneresults




msg:572515
 7:36 pm on Jul 24, 2003 (gmt 0)

My original suspicion about the number of lines between the two errors proved correct. You have an embedded and external style reference within your <body></body> tags. That is the first issue you need to address.

Also, can I get you to remove your URL reference as it is against board policy. Keep in mind that we do not perform site reviews here at the board, thank you.

g1smd




msg:572516
 7:38 pm on Jul 24, 2003 (gmt 0)

I took a look. Get a space in where I have indicated in underscores:

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

Take out the blank line between <title> and <link> maybe there is a non-printable character there.

Ahhhhhhh... the repeated <link> and <style> after the start of <body> are not valid. They MUST be before the closing </head> instead.

The next repetation of those tags is near the bottom of the page after a </div> tag. That is not valid code. Those <link> and <style> tags must be within <head> ... </head> only.

The problem might be with:

<!--#include file = "_includes/toptest.inc"-->

If you have the <link> and <style> inside that file, then you are inserting it more than once and inserting it in the wrong places.

claus




msg:572517
 11:52 am on Jul 25, 2003 (gmt 0)

janine, i have to insist. I copy-pasted your post into an empty doc, added end body and end html, saved it as "something.html" and ran it through the validator. Your errors did not come up.

There was another error, however. It said that the </head> tag was closing an element that was not finished. I tried deleting every meta except for the content-type, but the problem was persistent. Removing comment-tags (pageoneresults) and adding the missing space (g1smd) did not change anything. I think g1smd may be right - at some place a binary character could be there. Anyway, this was not the problem you posted about in the first place, so i thought that your code was actually valid and that the binary character had sneeked in in the process of copying form this forum.

Anyway, g1smd's advice about duplicates sounds like the right thing - i did not know there were duplicates, these should of course be removed.

/claus

jkruit




msg:572518
 1:48 pm on Jul 25, 2003 (gmt 0)

Thanks for not giving up on me.

I have made progress thanks to ya'll!

I am down to one error. Line 15, column 72: document type does not allow element "LINK" here (explain...).

This is what the validator says line 15 is.
..." type="text/css" href="_includes/texmed.css">

but when I look at line 15 in my document it says

<!--#include file = "_includes/toptest.inc"-->

This is my include page for the top of my webpage.

On the toptest.inc file the CSS link is the very first line on the page. <link rel="stylesheet" type="text/css" href="_includes/texmed.css">

On the page that I am validating, the is the first line after <body>
<!--#include file = "_includes/toptest.inc"-->

I tried changing the CSS file to and include file rather than a link but then the validator gave an error mesage. 500 Internal Server Error

Any more ideas?

Thanks
Janine

claus




msg:572519
 1:57 pm on Jul 25, 2003 (gmt 0)

That's exactly it. A duplicate. You should remove that stylesheet call from your include file, as the way you have included it it will get written both in the head section (which is the right place) and in the body (by means of the include; this is the wrong place)

The validator does not see the same documant as you do - it sees the documant after it has been parsed.

Use this interface: [validator.w3.org...]

and make sure to check the "Verbose output" option - that way you will get a line-numbered list at the bottom of the validation page with the results that the validator actually sees (that is: the page as it appears on the web after parsing includes, not in your local files)

/claus

jkruit




msg:572520
 7:12 pm on Jul 25, 2003 (gmt 0)

SUCCESS!

A big Texas Thanks to ALL Ya'LL

Janine

g1smd




msg:572521
 1:55 am on Jul 26, 2003 (gmt 0)

Glad you got there in the end. The hint from me was in:

The problem might be with:

<!--#include file = "_includes/toptest.inc"-->

If you have the <link> and <style> inside that file, then you are inserting it more than once and inserting it in the wrong places.

but maybe I should have written a longer explanation. Anyway the others managed to do that while I was away.

Success!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved