This repository has been archived on 2020-04-29. You can view files and clone it, but cannot push or open issues or pull requests.
namensschilder/namensschild.html

43 lines
960 B
HTML
Raw Normal View History

2019-03-27 20:30:59 +01:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
body {
white-space: nowrap;
object-fit: contain;
text-align: center;
font-family: "Roboto Condensed";
}
.container {
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
}
</style>
</head>
<body>
<div class="container">
<div id="name">Kein Name</div>
</div>
<script>
2020-04-29 16:26:14 +02:00
function setName(name) {
2019-03-27 20:30:59 +01:00
el = document.getElementById('name')
2020-04-29 16:26:14 +02:00
el.innerText = name
const elSize = {
2019-03-27 20:30:59 +01:00
width: el.offsetWidth,
height: el.offsetHeight
}
2020-04-29 16:26:14 +02:00
const browserSize = {
2019-03-28 19:15:35 +01:00
width: 180,
height: 60
2019-03-27 20:30:59 +01:00
}
factor = Math.min(browserSize.height / elSize.height, browserSize.width / elSize.width)
el.style.transform = `scale(${factor})`
}
</script>
</body>
</html>