A. Adorno horizontal

Salida

Ábrelo en otra pestaña.

Revísalo en gilpgedit.

1<!DOCTYPE html>
2<html lang="es">
3
4<head>
5 <meta charset="UTF-8">
6 <meta name="viewport"
7 content="width=device-width">
8 <title>Adorno Horizontal</title>
9 <style>
10 .sprite {
11 position: fixed;
12 }
13 </style>
14</head>
15
16<body>
17 <h1>Adorno Horizontal</h1>
18 <script>
19 const Y = 0
20 const DISTANCIA = 20
21 const X_MÁXIMA = innerWidth
22 let x = 0
23 /**
24 * En esta variable se agrega el
25 * HTML de las figuras que forman
26 * el adorno.
27 */
28 let inner = ""
29 while (x < X_MÁXIMA) {
30 /* Agrega el HTML de un emoji a
31 * inner. */
32 inner += /* html */
33 `<div class="sprite"
34 style="top: ${Y}px;
35 left: ${x}px;">
36 💕
37 </div>`
38 x += DISTANCIA
39 }
40 /* Agrega las figuras al HTML de
41 * body. */
42 document.body.innerHTML += inner
43 </script>
44</body>
45
46</html>
skip_previous skip_next