-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmomo.html
More file actions
36 lines (30 loc) · 780 Bytes
/
momo.html
File metadata and controls
36 lines (30 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<html>
<body>
<style>
@import url('https://fonts.googleapis.com/css?family=Sonsie+One');
text {
font-family: "Sonsie One";
}
svg {
background: #43C6AC;
}
</style>
<svg version="1.2" viewBox="0 0 600 400" width="600" height="400" xmlns="http://www.w3.org/2000/svg">
<text id="t1" style="fill: white;" x="50%" y="50%" text-anchor="middle">Test some long text here</text>
</svg>
<script>
function resize() {
var width = 350,
height = 80;
var textNode = document.getElementById("t1");
for (var k = 1; k < 60; k++) {
textNode.setAttribute("font-size", k)
var bb = textNode.getBBox()
if (bb.width > width || bb.height > height)
break;
}
}
window.onload = resize;
</script>
</body>
</html>