I got this to work, but I had to use javascript to set the transform
on the inner element. https://jsfiddle.net/ynheeut3/
html:
<div id="container">
<div id="fill">sample</div>
</div>
css:
#container {
position: absolute;
margin: 0;
padding: 0;
top: 0; bottom: 0; left: 0; right: 0;
overflow: hidden;
}
#fill {
margin: 0;
display: inline-block;
transform-origin: 0 0;
}
javascript:
function fillWithText () {
var fill = document.getElementById('fill');
var container = document.getElementById('container');
var totalHeight = container.clientHeight;
var totalWidth = container.clientWidth;
var currentHeight = fill.clientHeight;
var currentWidth = fill.clientWidth;
var scaleX = totalWidth / currentWidth;
var scaleY = totalHeight / currentHeight;
fill.style.transform = 'scale(' + scaleX + ',' + scaleY + ')';
};
window.addEventListener('resize', fillWithText, false);
fillWithText();