Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save birkestroem/45dfcf6903887d11e1ed to your computer and use it in GitHub Desktop.
Save birkestroem/45dfcf6903887d11e1ed to your computer and use it in GitHub Desktop.
Damn it, man, I'm a doctor, not a torpedo technician!
<table style="border: 1px solid red;">
<tr>
<td>
<div class="applicationName">
<h2>Tekst</h2>
</div>
</td>
<td>
2nd cell
</td>
</tr>
</table>
NodeList.prototype.forEach || (NodeList.prototype.forEach = Array.prototype.forEach);
document.querySelectorAll('div.applicationName').forEach(function (outer) {
var inner = document.querySelector('h2', outer);
var box = inner.getBoundingClientRect();
outer.style.width = box.width + 'px';
outer.style.height = box.height + 'px';
inner.style.transform = 'translate(0,' + (box.height) + 'px) ' + window.getComputedStyle(inner).transform;
});
table {
height: 300px;
}
div {
display: inline-block;
//background-color: blue;
h2 {
margin: 0;
padding: 0;
display: inline-block;
//background-color: yellow;
transform: rotate(-90deg);
transform-origin: 0 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment