Skip to content

Valid XHTML YouTube Embedding

I was checking validation on my pages and found the only XHTML errors were from the suggested YouTube embedding code. A quick search revealed several XHTML valid code examples, and here is what I am using to center the frame under XHTML 1.0 Transitional (this fails 1.0 Strict validation - to make this validate under Strict, just remove align=”center”..):

<p align="center">
<object type="application/x-shockwave-flash" style="width:425px; height:350px;" data="http://www.youtube.com/v/sdUUx5FdySs">
<param name="movie" value="http://www.youtube.com/v/sdUUx5FdySs" />
</object>
</p>

Update:
I am now using div’s to solve page formatting issues..:

<div>
<object type="application/x-shockwave-flash" style="width:425px; height:350px;" data="http://www.youtube.com/v/sdUUx5FdySs">
<param name="movie" value="http://www.youtube.com/v/sdUUx5FdySs" />
</object>
</div>

4 Comments

  1. Matthew wrote:

    Thanks, I used this to fix the errors on my site.

    Tuesday, May 29, 2007 at 11:45 pm | Permalink
  2. michael wrote:

    I’m not completely sure if it was an update to newer version of Wordpress or Veryplaintext (I did both at the same time), but I changed <p>…</p> to <div>…</div> and page formatting problems were corrected.

    Thursday, June 28, 2007 at 8:15 pm | Permalink
  3. mahud wrote:

    Thanks for the valid code. I had no idea that the code YouTube provided was invalid.

    Saturday, July 21, 2007 at 5:53 am | Permalink
  4. sg wrote:

    hi, thanks for this. I used it to fix my code which also includes borders and related videos (obtained via youtube’s “customise embed” option).

    This is what I did, and it validates fine to xhtml 1.0 transitional.

    Wednesday, January 2, 2008 at 11:52 am | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*