Set Up Your Environment
Before writing code, you need two things: a text editor and a browser. That's it. No complicated installs required.
On PC / Mac
- Download VS Code (recommended)
- Or use Notepad (Windows built-in)
- Copy the code into the editor
- Save the file as index.html
- Open it in any browser
On Phone
- Download Treb Edit from your app store
- Create a new .html file
- Paste your code in
- Preview directly in the app
- Keep internet on for best results
Try It Yourself
The best way to learn HTML is by running real code. Click Run on any example to see it live.
Every HTML page starts with this skeleton. The <body> is where visible content lives. It's empty here — so the output is blank.
<!-- Basic HTML structure --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>Document</title> </head> <body> <!-- Content goes here --> </body> </html>
Now we add a paragraph inside the body. The <p> tag wraps a block of text and adds spacing around it automatically.
<!DOCTYPE html> <html lang="en"> <head> <title>My Page</title> </head> <body> <p>This is a test. For more, contact us.</p> </body> </html>
Using the style="" attribute, we can add CSS directly to any element. Here we change the background and text color.
<body style="background-color: bisque;"> <p style="color: darkgoldenrod;"> This is a test on what we are practicing. For more contact us. </p> </body>
Keep Building
You've got the foundation. Here's what to tackle next on your web dev journey.