Lesson 1 Β· LecciΓ³n 1 Β· Estructura HTML
Every website starts as a skeleton β an HTML file that tells the browser what to load. In this lesson you'll see how our visualization page is structured and why each piece is there.
Todo sitio web empieza como un esqueleto β un archivo HTML que le dice al navegador quΓ© cargar.
Before writing any code, let's see how the project is organized. Think of it like folders and papers on a desk:
Tip: The docs/ folder is what GitHub puts
on the internet. Everything inside it becomes your live website.
The <head> is invisible to visitors but very important β
it loads fonts, styles, and tells the browser about Three.js.
<!-- Tell the browser this is HTML5 --> <!DOCTYPE html> <html lang="en"> <head> <!-- Character set (handles Spanish, Chinese, etc.) --> <meta charset="UTF-8" /> <!-- Mobile-friendly sizing --> <meta name="viewport" content="width=device-width" /> <!-- Load Google Fonts --> <link href="https://fonts.googleapis.com/..." /> <!-- Load our styles --> <link rel="stylesheet" href="css/style.css" /> </head>
Why charset="UTF-8"?
UTF-8 supports over 1 million characters β including Spanish accents
(Β‘Hola!), Chinese (δ½ ε₯½), Arabic (Ω
Ψ±ΨΨ¨Ψ§), and more. Always include it!
Three.js is a huge library. Instead of downloading it, we tell the browser where to find it online using an import map:
<script type="importmap"> { "imports": { "three": "https://unpkg.com/three@0.163.0/...", "three/addons/": "https://unpkg.com/three@0.163.0/jsm/" } } </script>
Now any JavaScript file can write import * as THREE from 'three'
and the browser knows exactly where to get it. No npm, no bundler needed!
The body holds everything visitors actually see. Our page has just a few key elements:
<body> <!-- Three.js draws here (full-screen canvas) --> <canvas id="canvas"></canvas> <!-- Title card (top-left overlay) --> <header class="title-card"> <h1>Oakland Habla</h1> <p>Language Diversity 2016β2017</p> </header> <!-- Start the JavaScript --> <script type="module" src="js/main.js"></script> </body>
Notice type="module" on the script tag. This tells the
browser our JavaScript uses modern ES Modules β the same system
that lets us import Three.js without a build step.
Open docs/index.html in your text editor. Find the
<h1> tag and change "Oakland Habla" to your own title.
Save the file, then open it in a browser to see your change!
Abre docs/index.html en tu editor. Cambia el texto del
<h1>. Β‘Guarda y refresca el navegador!