[whatwg] VIDEO tag height/width best fit

Philip Jägenstedt philipj at opera.com
Sun Aug 3 22:35:52 PDT 2008

Video is automatically scaled to fit inside its "box" while maintaining
the correct aspect ratio.


On Mon, 2008-08-04 at 00:19 -0400, Biju Gm at il wrote:
> I apologize if I did not understood
> http://www.whatwg.org/specs/web-apps/current-work/#video
> I see a situation where we want to specify the height and width of the
> BOX in which a video need to be displayed. And while writing HTML code
> we dont know the height/width of the video. But when playing we want
> the video to be displayed with maximum size which can fit in the BOX
> without loosing the aspect ratio.
> After reading the <video> tag specification I dont see a way to
> achieve this with out javascript code.
> We should have one more attribute to tell how to "fit" the image/video
> == "fit" attribute values ===
> * center          - if it is small keep at center
> * stretch         - stretch/skew height and width to fit
> * stretch-height  - stretch/skew height only to fit,
>                     adjust width to maintain aspect ratio.
> * stretch-width   - stretch/skew width only to fit,
>                     adjust height to maintain aspect ratio.
> * stretch-best    - stretch/skew height or width to maximum
>                     so that other will fit in
>                     and maintain aspect ratio.
> May be we can also have a "tile" option
> This problem also exist for <img> tag.
Philip Jägenstedt
Opera Software

More information about the whatwg mailing list