Menu
I went through W3school’s CSS tutorial, and maybe I am blind, but I didn’t come across anything about DOCTYPE. I couldn’t figure out why my page wasn’t picking up any of the external style sheet. Can somebody give me a quick explanation of what DOCTYPE is and how to use it? I’ll get the code up soon.
[CODE]<HTML>
<HEAD>
<LINK href="jwstyle.css" rel="stylesheet"
type="text/css">
</HEAD>
<BODY>
<P class="default">This is a default paragraph
stlye.
</BODY>
</HTML>[/CODE]
[CODE]body {background-color: rgb (239,219,181)
url('cloth034.png') repeat fixed;}
p.default {font-size:11pt; margin-left: 15px}[/CODE]
Matching </p> tags for every <p> are needed though for the HTML to be valid.[/QUOTE]That is completely false. HTML has [i]lots[/i] of optional tags and other things and the P element end tag is not needed.
<!ELEMENT P - O (%inline;)* -- paragraph -->
[/quote]
That's from the HTML 4.01 DTD that your DOCTYPE points to. It's in a semi-human readable format and it tells the browser that the P element has a start tag, "-", and an optional end tag, "O" and it contains zero or more inline elements. Inline elements are defined elsewhere in the DTD but the P element is not among them. If you omit the end tag and follow with any non-inline element the browser automatically inserts the closing tag for the P element.If you want to choose where the paragraph ends so that any styles are applied correctly to the paragraph in all browsers then you need to include it.Forgive me for being out of line here, but I am continually floored that you are permitted to teach a subject about which you know so little.
It may be valid to leave it out but that is telling the browser that it can choose for itself where the paragraph ends and so different browsers will make different choices resulting in the page appearing differently in different browsers. Since the idea of using standard valid code is to try to get the page to look the same on all browsers then leaving out optional end tags is not something that you should consider doing.[/QUOTE]
I am constantly amazed that you have such a non-existant understanding of the difference between what the standards say and how real web browsers actually work - which are not necessarily all that close to being the same thing.There is quite a bit of a difference between some relatively new feature and something that was there from the start. Optional tags is and always has been a fundamental feature of HTML.
Often good programming practice differes significantly from both and it is good programming practice to include all "optional" tags unless they are optional through not actually being relevant to particular situations.[/QUOTE]
[i]From the original IETF DTD:[/i]Every browser does and always has understood that certain tags are optional.
<!ENTITY % font " TT | B | I ">
<!ENTITY % phrase "EM | STRONG | CODE | SAMP | KBD | VAR | CITE ">
<!ENTITY % text "#PCDATA | A | IMG | BR | %phrase | %font">
<!ELEMENT P - O (%text)*>
[i]http://www.w3.org/MarkUp/html-spec/html-spec_9.html#SEC9.1 [/i][/quote]
Over the last 30+ years of programming and 25+ years of using markup languages I have read many hundreds of standards manuals many of which are as applicable to the web as to the various other environments that they apply in. Many of these are as "official" as the SW3C standard (which appears to be the only one out of thousands that you appear to even know exists) while others actually are official standards. I therefore have no need whatever to go making up standards.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd ">[/QUOTE]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
[i]From the HTML 4.01 transitional DTD:[/i]Well, that day came long ago and we're not supposed to be using the transitional DTD any more.
This is the HTML 4.01 Transitional DTD, which includes
presentation attributes and elements that W3C expects to phase out
as support for style sheets matures. Authors should use the Strict
DTD when possible, but may use the Transitional DTD when support
for presentation attribute and elements is required.
[i]http://www.w3.org/TR/REC-html40/sgml/loosedtd.html [/i][/quote]
To see it really working save the file with a ".xml" extension and view it in MSIE.[/QUOTE]
<i>
</i>body {background-color: rgb (239,219,181)
url('cloth034.png') repeat fixed;}
<i>
</i>body {background: rgb (239,219,181) url('cloth034.png') repeat fixed;}
0.1.9 — BETA 5.27