/
index.html
43 lines (39 loc) · 981 Bytes
/
index.html
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
37
38
39
40
41
42
43
<html>
<head>
<title> CSS Utilities </title>
<style>
label, input {
display: block;
padding: 10px;
width: 90%;
}
form {
border: 2px solid black;
width: 300px;
padding: 20px;
float: left;
margin-right: 10px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(function() {
//pixels to rem
$('input[name=target_font]').on('keyup', function(){
$('input[name=value_rem]').val((1/$('input[name=default_font]').val()) * $('input[name=target_font]').val());
});
});
</script>
</head>
<body>
<form action='#'>
<legend> Pixels to REM </legend>
<label> Default Font (px) </label>
<input type='text' name='default_font' value='16'>
<label> Target Font (px) </label>
<input type='text' name='target_font' value=''>
<label> Value in REM </label>
<input type='text' name='value_rem' value=''>
</form>
</body>
</html>