March 6, 2013

CSS child bigger than parent allowed?

Question by Programista

Quick question.

I know i can make child div bigger than parent, but is it allowed by w3c? Is it against some rules? Any performance problems?

Answer by albertxing

There are many cases where you would need an overflow in the parent div, with a larger child div: for example, a fixed-position content frame.

And there should be no performance impediment; it should be around the same as rendering the child div as a sibling of the parent.

Answer by Starx

W3C specifications does not limit you what kind of value you use for its attributes, except for few cases like:

  • Integer Id Attribute

So, to answer your question, Yes it is allowed.

April 9, 2012

How to make youtube embed code HTML valid for w3c validator?

Question by Shree

Here is my code.

<div>
    <object>
        <param name="movie" value="http://www.youtube.com/v/Cbspv1ZKR8o?version=3&amp;hl=en_US" />
        <param name="allowFullScreen" value="true" />
        <param value="transparent" name="wmode" />
        <param name="allowscriptaccess" value="always" />
        <embed src="http://www.youtube.com/v/Cbspv1ZKR8o?version=3&amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" class="cssVideo"></embed>
    </object>
</div>

But the above code failed to pass the W3C Validator.
I search and try to follow these guides but I am unable to solve the problem.

Can anyone help me with this? Thanks.

Answer by Starx

Actually, you don’t need to always use the embeded code provided from youtube.

Below is a typical way to change the embedded version of the youtube and validate it as well.

<object type="application/x-shockwave-flash" width="425" height="350" data="http://www.youtube.com/v/n">
     <param name="movie" value="http://www.youtube.com/v/n" />
     <a href="http://get.adobe.com/flashplayer/" target="blank"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get flash player to play to this file" width="88" height="31" /></a><br />
</object>

Where n is the youtube id of the video.

See a demo validation result

Cheers Prabhu 🙂

...

Please fill the form - I will response as fast as I can!