- From: 张立理 <otakustay@live.com>
- Date: Mon, 19 Nov 2012 17:35:08 +0000
- To: "www-style@w3.org" <www-style@w3.org>
- CC: 吕康豪 <kanghaol@oupeng.com>
- Message-ID: <COL401-EAS277924F21B43A1437A6977ED8560@phx.gbl>
Hi all, I know normal percentage (%) could represents a percentage length of its parent, but ONLY to the related orientation. Now we have a simple task: to embed an iframe (or div, anything) into our content, we don’t know our parent’s width, however we are sure the iframe (div) should have a 4:3 in its width:height size. It’s hard today, without javascript dynamically adjusting the style of our iframe (div), the core issue is we do not have any approach to reach parent’s width or height as a CSS length. I propose a pw / ph unit, like vw and vh, to give a parent-percentage length, 1vw means 1% of the width of its parent, so I could write my css like this: iframe { width: 100%; /* or 100vw, it’s OK */ height: 75vw; /* this is the core issue */ } Unless we could mix calc() and attr() together, so we could do calc(attr(width) * 0.75), the vw unit is really useful when embedding a skydrive / slideshare / jsfiddle to our content and it seems not that hard to implement. Thanks. Gray Zhang ------------- 电子邮件:otakustay@live.com 微博:@otakustay 博客:http://otakustay.com
Received on Monday, 19 November 2012 17:35:41 UTC