html - Is There Any Way To Force An Element Sized Using An Intrinsic Ratio To Fill Its Container Vertically As Well As Horizontally? -



html - Is There Any Way To Force An Element Sized Using An Intrinsic Ratio To Fill Its Container Vertically As Well As Horizontally? -

sassmeister here

if element's dimensions defined using intrinsic ratio:

sass:

body, html, .wrapper { width:100%; height: 100%; } .videocontainer { position: relative; max-width: 100%; height: 0; overflow: hidden; &.sixteen-nine { padding-bottom: 56.25%; } &.four-three { padding-bottom: 75%; } } .videocontainer iframe, .videocontainer object, .videocontainer embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

html:

<div class="wrapper"> <div class="videocontainer vimeo sixteen-nine"> <iframe src="http://player.vimeo.com/video/109777141?byline=0&amp;portrait=0&amp;badge=0&amp;color=090909" class="js-only" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe> </div> </div>

is there way contain resizes hight of container?

it resize width of container while maintaining aspect ratio, however, wrapper defines explicit height, overspill container if width of wrapper compared height greater aspect ratio.

i need back upwards ie9+ , don't want utilize javascript

can tell me if had in mind?

.wrapper { display: block; width: 100%; } .videocontainer { position: absolute; height: 100%; display: block; width: 100%; &.sixteen-nine { padding-bottom: 56.25%; } &.four-three { padding-bottom: 75%; } } .videocontainer div { height: 100%; } .videocontainer div iframe{ height: 100%; width: 100%; } <div class="wrapper"> <div class="videocontainer vimeo sixteen-nine"> <div> <iframe src="http://player.vimeo.com/video/109777141?byline=0&amp;portrait=0&amp;badge=0&amp;color=090909" class="js-only" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe> </div> </div> </div>

html css layout sass intrinsic-ratio

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -