• Top class table-less, CSS designs
  • Highly optimized for performance
  • Various theme configuration options
  • Themes with installation profile
  • Free E-mail support
PSD to Drupal
PSD to Drupal

Get your design converted into world class Drupal theme by Drupal experts. Our PSD to Drupal service starts from just $599.

More details

User login

Recent comments

How to make youtube embed code XHTML valid

Recently I put youtube's embed video code on one of my website and tried check it on XHTML validator, I got some errors related to youtube code and my webpage became invalid. So here I found a way to make it valid with the help of css.

This is the code that youtube.com gives you:
<object width="384" height="313">
    <param name="movie" value="http://www.youtube.com/v/LU8DDYz68kM&amp;hl=en_US&amp;fs=1" /><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" />
    <embed width="384" height="313" src="http://www.youtube.com/v/LU8DDYz68kM&amp;hl=en_US&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true">
    </embed>
</object>
Here is the test results from validator.w3.org

The Solution:

We will do the following:
  1. Remove bad codes from the original code.
  2. Wrap the content with a div.
  3. Styling with CSS.

Remove width and height attribute from «object». Remove other «param» tags except the one shown below. Also remove any extention from video URL like I have done.

Valid code:
<div class="YTvideos">
    <object type="application/x-shockwave-flash" data="http://www.youtube.com/v/LU8DDYz68kM">
        <param name="movie" value="http://www.youtube.com/v/LU8DDYz68kM" />
    </object>
</div>

Styling

.YTvideos object{
	/* You can set it custom */
	width:384px;
	height:313px;
}

Final html code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>YT test</title>
    <style type="text/css">
        .YTvideos object {
            /* You can set it custom */
            width: 384px;
            height: 313px;
        }
    </style>
</head>
<body>
    <div class="YTvideos">
        <object type="application/x-shockwave-flash" data="http://www.youtube.com/v/LU8DDYz68kM">
            <param name="movie" value="http://www.youtube.com/v/LU8DDYz68kM" />
        </object>
    </div>
</body>
</html>
Now this is Valid XHTML
Posted under:

Custom Project

If you are looking for a Custom Drupal theme or Drupal project developer, you can contact us to get a quote.

Contact

Theme customization

We offer affordable Drupal theme customization service. You can use this service to let us customize your theme.

Drupal organization member
Paypal verified

Recent Free Themes

Recent Articles