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

From: Date: Sun, 21 Sep 2008 13:27:11 +0000
Subject: Re: <br> was [PHP] Re: render html
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-280633@lists.php.net to get a copy of this message
On Sun, 2008-09-21 at 09:16 -0400, tedd wrote: > At 8:17 AM +0200 9/21/08, Lupus Michaelis wrote: > >Michelle Konzack a écrit : > >>>$body = "hello<br/><ul>ier</ul>hellohello"; > >> ^^^^^ > >> Should be <br /> > > > > Definitely no : > > > > >><http://www.w3.org/TR/2006/REC-xml-20060816/#dt-empty> > ><http://www.w3.org/TR/2006/REC-xml-20060816/#NT-S> > > > > Or maybe for buggy browsers ? > > > >>> Definitely no ??? <<< > > I've always found this confusing. > > If one uses a <br> tag, you'll get a single line > break and everything validates per W3C -- as long > as you're not using a xml doctype. > > If you use <br/> or <br /> tags, then both will > generate a line break, but both will also > generate W3C shorttag validation warnings. > > If you use <br></br>, then you'll get a single > line break, but that will also generate a W3C > validation error, which is worse than a warning. > > However, if you read this: > > <http://www.w3.org/TR/2006/REC-xml-20060816/#dt-empty> > > One would think that using <br></br> or <br/> > tags are fine, but they're not -- and <br> isn't > even mentioned. > > So considering all the different ways one can do > this, the one that's the least problematic is > <br>. > > Of course, one could use: > > <div> > &nbsp; > </div> > > and side-step the entire issue. > > Cheers, > > tedd > > > -- > ------- > http://sperling.com > http://ancientstones.com > http://earthstones.com > You will only get the errors you describe if you've messed up the document type declaration. I always use this one for my sites: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> and it never gives shorttag warnings or errors. Ash www.ashleysheridan.co.uk

« previous php.general (#280633) next »