4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 CSS not working and unsure of my DTD
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
GuruOnAMountain
Junior WebHelper
Junior WebHelper


Joined: 27 Feb 2008
Posts: 2

PostPosted: Wed Feb 27, 2008 4:02 pm (16 years, 1 month ago) Reply with QuoteBack to Top

I'm very new to this, but tried a website, DTD and CSS sheet before using a step by step guide and managed to get it all to work fine. Now, however, I'm trying it on my own for the first time and struggling. No matter what I've tried, I've had no luck. I also think I've done my DTD wrong, but I'm not sure if that would effect the CSS sheet or not, I'm guessing that it wouldn't.

I'll copy and post my website and CSS code below. If any one could give me a step for a hint, it'd be much appreciated!!

This is my website code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE website [
<!ELEMENT website (header,title,graphic,body,sidebar,button,content)
<!ELEMENT header (title,graphic)>
<!ELEMENT body (sidebar,button,content)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT graphic (#PCDATA)>
<!ELEMENT sidebar (#PCDATA)>
<!ELEMENT p (#PCDATA)>
<!ELEMENT content (#PCDATA)
]>

<?xml-stylesheet href="website.css" type="text/css"?>
<website>
<header>
<title>Suck It & See!</title>
<graphic><img src = "Lolly3.gif" alt = "Lolly Logo"/></graphic>
</header>
<body>
<sidebar>
<p><a href = "Homepage.html"><img src = "HomeButton.png" alt = "Home"/></a></p>
<p><a href = "LogInPage.html"><img src = "LogInButton.png" alt = "Log In"/></a></p>
<p><a href = "RegisterPage.html"><img src = "RegisterButton.png" alt = "Register"/></a></p>
<p><a href = "ViewItemsPage.html"><img src = "ViewItemsButton.png" alt = "View Items"/></a></p>
<p><a href = "AboutUsPage.html"><img src = "AboutUsButton.png" alt = "About Us"/></a></p>
<p><a href = "ContactUsPage.html"><img src = "ContactUsButton.png" alt = "Contact Us"/></a></p>
<p><a href = "HelpPage.html"><img src = "HelpButton.png" alt = "Help"/></a></p>
</sidebar>
<content>
Welcome to Suck It & See!
</content>
</body>
</website>

CSS code (there's not much too this....I'll do more once I manage to get this little bit working):

content {
font-weight:bold;
color:red;
}

Thanks in advance!!
OfflineView User's ProfileFind all posts by GuruOnAMountainSend Personal Message
Robert Wellock
WebHelper
WebHelper


Joined: 18 Jan 2002
Posts: 61
Location: Yorkshire - UK

PostPosted: Thu Feb 28, 2008 4:08 pm (16 years, 1 month ago) Reply with QuoteBack to Top

I assume you are serving it as 'application/xml' or 'text/xml' and viewing it via something like Mozilla your style sheet must come directly after; <?xml version="1.0" encoding="UTF-8"?> line, i.e. reside on the second line before the ... !DOCTYPE ... plus you must escape the two ampersands.

If you just use the plain XML file without the DTD it will then work - CSS only matches patterns it doesn't care about which markup language you use.

You have a few other typos too so I've fixed them below:

Code:
<!DOCTYPE website [
<!ELEMENT website (header,title,graphic,body,sidebar,button,content)>
<!ELEMENT header (title,graphic)>
<!ELEMENT body (sidebar,button,content)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT graphic (#PCDATA)>
<!ELEMENT sidebar (#PCDATA)>
<!ELEMENT p (#PCDATA)>
<!ELEMENT content (#PCDATA)>
]>


Thus if you want to add the DTD and make it useful you will need to add more valid the attributes, etc.

________________________________
};-) http://www.xhtmlcoder.com/
OfflineView User's ProfileFind all posts by Robert WellockSend Personal MessageVisit Poster's Website
GuruOnAMountain
Junior WebHelper
Junior WebHelper


Joined: 27 Feb 2008
Posts: 2

PostPosted: Fri Feb 29, 2008 11:47 am (16 years, 1 month ago) Reply with QuoteBack to Top

Thanks very much for the help! Very Happy
OfflineView User's ProfileFind all posts by GuruOnAMountainSend Personal Message
Robert Wellock
WebHelper
WebHelper


Joined: 18 Jan 2002
Posts: 61
Location: Yorkshire - UK

PostPosted: Wed Mar 12, 2008 12:42 pm (16 years, 1 month ago) Reply with QuoteBack to Top

No problem.

________________________________
};-) http://www.xhtmlcoder.com/
OfflineView User's ProfileFind all posts by Robert WellockSend Personal MessageVisit Poster's Website
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.436897 seconds :: 19 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme