Jump to content

DTD Problems


Cav

Recommended Posts

Here's my html document,when I leave the DTD out it displays fine by when I added the DTD it only displays the the text in the html doc, it leaves out all my images linked through the stylesheet. but the colors I specified are getting through, I can't figured it out?<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE htmlPUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/TR/xhtml1" xml:lang="en" lang="en"><head><title>Company XYZ</title><link rel="stylesheet" "type="text/css" href="companyxyz.css" /></head><body><div id="tableheader"><a href="companyxyz.html" ></a></div><div id="text"></div><div id="menu"></div><div id="menulinks"><a href="companyxyz.html">Home</a><br /><a href="companyxyzproducts.html">Lamps</a><br /><a href="companyxyzabout.html">About</a><br /><a href="companyxyzcontact.html">Contact</a><br /></div><div id="background"></div><div id="content">This is the landing page and where the introduction will be located along with featured products. </div><div id="privacy"><a href="companyxyzprivacy.html"><h6>"Privacy Statement"</h6></a></div><div id="footer"><h6>Produced By: companyxyz©2008</h6></div></body></html>

Link to comment
Share on other sites

Guest FirefoxRocks

First of all, welcome to the W3Schools Forum!! You will find that our community here is very helpful.As a general rule, you should wrap HTML code in

<div> Put [html] tags around the code! (And also include the relevant parts or your whole document)</div>

Now for your issue with the DTD. My assumption is the problem is you have an exra quotation mark in front of the type attribute on the <link /> tag. You have "type="text/css" which is incorrect.Some other errors in your document include the xmlns attribute not equal to default value (it must be xmlns="http://www.w3.org/1999/xhtml"). Also, the copyright logo should be inserted with © .Without the doctype declaration, the browser uses quirks mode, and guesses at the page layout. With the DTD, standards mode is used, and the browser renders the content to the best of its ability.

Link to comment
Share on other sites

It may be that you're doing something wrong in your CSS that's causing this to happen when running un standards compliant mode.Can you show one of your background image declarations?

Link to comment
Share on other sites

<b> Here's the css doc</b>/*Site layout*/body {width:840px;height:900px;margin-bottom:100px;margin-top:-100px;background-image:url(C:\Documents and Settings\Guest\My Documents\Web Design\WebWriteUp\tablebackground.png);}#tableheader{width:810px; height:215px; padding-left:200px;margin-top:100px;margin-bottom:-250px;background-image:url(C:\Documents and Settings\Guest\My Documents\Web Design\WebWriteUp\tableheader.png); }#text{width:810px;height:215px;clear:none;margin-bottom:100px;background-image:url(C:\Documents and Settings\Guest\My Documents\Web Design\WebWriteUp\tabletext.png);}#menu{width:148px;height:307px;float:left;margin-top:-100px;background-image:url(C:\Documents and Settings\Guest\My Documents\Web Design\WebWriteUp\menubartable.png);}#menulinks{float:left;font-family:engravers mt;font-weight:bold;line-height:30px;margin-left:-125px;margin-top:-75px;}#menulinks a:hover{background-image:url(C:\Documents and Settings\Guest\My Documents\Web Design\WebWriteUp\menuhighlight.png);}#menulinks a:visited{color:white}#menulinks a:active{font-style:oblique;}#content{color:blue;clear:both;margin-top:auto;padding-left:200px;padding-bottom:500px:}#privacy{margin-top:auto;padding-top:1000px;padding-left:35%;clear:left;}#footer{padding-top:-15px;padding-left:30%;margin-bottom:auto;margin-top:auto;margin-left:auto;margin-right:auto;clear:none;}table.one{padding-left:auto;margin-left:180px;clear:none; }

Link to comment
Share on other sites

I think the problem might be that you need to use the file:// protocol to access pictures on your computerfile:///C:\Documents and Settings\Guest\My Documents\Web Design\WebWriteUp\tablebackground.pngBut even better than that would be to use relative URLs:background-image: url(tablebackground.png)

Link to comment
Share on other sites

Awsome it worked, could you explain to my why it did that, I just want to understand why it worked before without the DTD and did not with it.Once again thank you guys for your help.[b/]

Link to comment
Share on other sites

By adding a valid Doctype to your HTML document it makes the browser in "standards compliant mode" (following the W3C rules). Some things that aren't standard might not work correctly in standards compliant mode. I suppose that the file:// protocol is the official way to call local files.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...