Spaces:
Running
Running
Update index.html
Browse files- index.html +63 -19
index.html
CHANGED
@@ -1,19 +1,63 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>HTML Playground</title>
|
7 |
+
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
|
8 |
+
</head>
|
9 |
+
<body class="m-0 p-0">
|
10 |
+
<div class="grid grid-cols-2 w-screen h-screen divide-x divide-amber-300">
|
11 |
+
<div class="bg-gray-200">
|
12 |
+
<textarea id="code-input" class="w-full h-full font-mono p-2 resize-none"><!DOCTYPE html>
|
13 |
+
<html lang="en">
|
14 |
+
<head>
|
15 |
+
<meta charset="UTF-8">
|
16 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
17 |
+
<title>Document</title>
|
18 |
+
<style>
|
19 |
+
body {
|
20 |
+
font-family: Arial, sans-serif;
|
21 |
+
background-color: #f0f0f0;
|
22 |
+
}
|
23 |
+
h1 {
|
24 |
+
color: navy;
|
25 |
+
}
|
26 |
+
</style>
|
27 |
+
</head>
|
28 |
+
<body>
|
29 |
+
<h1>Welcome to the HTML Playground</h1>
|
30 |
+
<p id="message">Click the button to change this text.</p>
|
31 |
+
<button onclick="changeText()">Change Text</button>
|
32 |
+
<script>
|
33 |
+
function changeText() {
|
34 |
+
document.getElementById('message').innerText = 'Text changed!';
|
35 |
+
}
|
36 |
+
</script>
|
37 |
+
</body>
|
38 |
+
</html></textarea>
|
39 |
+
</div>
|
40 |
+
<div>
|
41 |
+
<iframe id="output" class="w-full h-full border-none"></iframe>
|
42 |
+
</div>
|
43 |
+
</div>
|
44 |
+
<script>
|
45 |
+
document.addEventListener('DOMContentLoaded', () => {
|
46 |
+
const codeInput = document.getElementById('code-input');
|
47 |
+
const output = document.getElementById('output');
|
48 |
+
|
49 |
+
function updateOutput() {
|
50 |
+
output.contentDocument.open();
|
51 |
+
output.contentDocument.write(codeInput.value);
|
52 |
+
output.contentDocument.close();
|
53 |
+
}
|
54 |
+
|
55 |
+
// Initial render
|
56 |
+
updateOutput();
|
57 |
+
|
58 |
+
// Update on every input
|
59 |
+
codeInput.addEventListener('input', updateOutput);
|
60 |
+
});
|
61 |
+
</script>
|
62 |
+
</body>
|
63 |
+
</html>
|