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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux