PDA

View Full Version : new html


chrismiceli
03-09-2003, 04:31 AM
I used to be very up2date w/ html, now I am starting to see this
<br/>
and
<p/>
i am used to original
<br>
and
<p>
could someone explain?

brothercake
03-09-2003, 05:01 AM
Those are XHTML.

XHTML is XML, and so all its elements must be closed. But HTML contains empty elements - those like <br> which have no closing tag. So this is how they're expressed.

For example

<br></br>

is the same as

<br/>

and

<link></link>

is the same as

<link/>

However that precise syntax breaks in older browsers - browsers which came out before XHTML. So to allow for them, you put a space before the backslash, like these examples

<br />
<link rel="stylesheet" type="text/css" href="styles.css" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />



You can find more info at w3schools XHTML tutorial (http://www.w3schools.com/xhtml/default.asp) and I'd encourage you to start using it. To coin a phrase - "please upgrade your coding" ;)

FJbrian
03-10-2003, 05:43 AM
They have been "about to" become stricter on coding for years now and never have.
Several editors actually add in tags like you mentioned and also /img
they can stay, works the same with or without. No biggie

cg9com
03-10-2003, 06:33 AM
Originally posted by chrismiceli

<p/>
the slash is needed only for empty elements, something like a container <p>,
still needs to be treated like <p></p>.

also FJBrian, strict coding is more user enforced, and there are standard compliant browsers, and DTD's to adhere to.

FJbrian
03-10-2003, 07:08 AM
I use webscripter as my editor.
depending on what I'm doing(or how lazy I am) it creates the code and may put an /img tag OR I may enter it and not put an /img tage.
Pages look the same regardless.
From what I understand,(which I don't really :) )one is correct in XHTML and one correct in HTML
or maybe it's HTML 3.2 and 4.0????

Not sure which. There is such a vast array of browser's visiting one's site, some even old ones that may not recognize a /img tag, I just do whatever. Hasn't hurt me one bit.
Once W3C raises the standard and there is a strict adherence then folks like me will need to mind our p's and q's. For now, much todo about nothin' IMHO

cg9com
03-10-2003, 07:39 AM
like brothercake stated above, xhtml is xml and needs to be treated like a plain xml document, thus empty tags (which dont exist in a valid xml document) need to be treated as closed with a slash /
html can have empty tags like <hr>

it wouldnt actually be /img ( or am i misunderstanding you )
it would be <img /> and thats if you are using xhtml.

Roy Sinclair
03-10-2003, 05:16 PM
A quick point, <p/> is not valid xHTML, the <p> tag cannot be empty in valid xHTML code. When you see that, you're seeing a case where the <p> tag is incorrectly being used in place of a <br /> tag.

brothercake
03-10-2003, 11:17 PM
Originally posted by FJbrian
For now, much todo about nothin' IMHO

I used to think like that; it wasn't until I learned about XML that I really appreciated the value of XHTML.

XHTML is about removing style and formatting from HTML, and concentrating on structure and semantics; as the w3c so nicely put it - "HTML is about data and how data looks; XML is about data and what data is".

XML and their related technologies (XHTML,XSL,XPath,XPointer,XLink ... lots more) give us a common framework for interoperability which is platform and process independent :thumbsup: Tie myself into a vendor specific solution? I think not :p Not in the brave new world of XML :D

Anyone else care to take over, or shall I ramble on some more ...?

<btw to="cg9com">
empty elements are perfectly valid in 'pure' XML, and they're expressed in the same way - <element/>
</btw>