Re: <br> was [PHP] Re: render html

From: Date: Mon, 22 Sep 2008 15:15:58 +0000
Subject: Re: <br> was [PHP] Re: render html
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.general 
Request: Send a blank email to php-general+get-280691@lists.php.net to get a copy of this message
On Sep 22, 2008, at 9:24 AM, tedd wrote:
At 8:37 PM +0100 9/21/08, Stut wrote:
That's what the DocType is. It tells the browser what version of (X)HTML you're using and therefore which tags are allowed and which are not. It has a major effect on some browsers, and if you use the right one it can help a lot when trying to make pages look the same in all browsers. Worth reading up on. -Stut
-Stut: I've done a lot of reading about DOCTYPE's and I realize that the DOCTYPE statement tells the browser what version of (X)HTML the web page is, but I never made the connection that would limit how one could use the <br> tag. You know, you can read about the "br" tag everywhere without any mention of DOCTYPE. So in the end, we have <br>, <br/>, <br />, and <br></br> -- depending on what DOCTYPE you're using -- that sure makes things simpler, huh? Thanks for enlightening me on this. Cheers, tedd
If you're using XHTML at all, when you do a 'br' tag, the '/' is required. Since XHTML (a type of XML) is only valid if well-formed, not having the trailing '/' causes the document to not be valid XML. It does not matter if you have the space or not before the forward slash - the white space is ignored there anyway. So, <br> is not valid XHTML, but <br/> and <br /> are. I personally use the one without the space. And <br></br> is just not right at all (at least for XHTML, and I doubt for any other doctype). You can look at the DTD for XHTML and see that <br></br> is not an option. http://www.w3.org/QA/2002/04/valid-dtd-list.html ~Philip PS... tedd, I merely piggy-backed off of your email. This was meant for the list as a whole. ;)

« previous php.general (#280691) next »