HTML Syntax, the DOM & DevTools: Notes from My Learning
On the journey to fullstack developer, today's stretch of the freeCodeCamp curriculum was all about the tools that surround HTML: how the browser reads my markup, what an HTML validator is, what the DOM actually is, and how to debug pages with the built-in developer tools. Here's the plain-language version.
1. HTML syntax in one minute
HTML is ordinary text with special markers called tags. A tag usually comes in a pair — an opening tag and a closing tag — and whatever sits between them is the content. A tag plus its content is called an element.
<a href="https://www.freecodecamp.org/learn/">Visit freeCodeCamp</a>
Breaking that anchor element down, piece by piece:
<a>— the opening tag. It says "a link starts here."href="..."— an attribute: extra information that lives inside the opening tag. Here it holds the address the link points to.Visit freeCodeCamp— the content, the text people actually see and click.</a>— the closing tag. Note the slash.
That's most of HTML syntax in practice: elements, attributes tucked inside opening tags, and elements nested inside other elements.
2. HTML is forgiving — sometimes too forgiving
Something that surprised me today: browsers almost never complain about broken HTML. Forget to close a tag, and the browser just guesses what you meant and renders the page anyway.
<h1>My Learning Blog
<p>I never closed the h1 above,
and the browser still shows this text.</p>
So why not let the browser fix everything? Because its guess isn't always your intention. The browser may "repair" the page in a different spot than you expected, and suddenly a whole section has the wrong layout — with no error message anywhere to point at the real cause.
The fix is an HTML validator: a tool that checks your page against the official HTML rules and lists every mistake with a line number. The classic one is the free W3C Markup Validation Service — paste a URL or upload a file, and it shows exactly what to fix. That's the habit I'm taking from today: validate before you celebrate.
Run every new page through validator.w3.org once before publishing. It catches unclosed tags, typos in attributes, and the sneaky little mistakes the browser quietly papers over.
3. The DOM: the browser's live copy of your HTML
So what happens to my HTML after the browser reads it? The browser builds the DOM — the Document Object Model. It's a live tree of objects, where every element, attribute, and piece of text becomes a node:
document
└── html
└── body
├── h1 → "My Learning Blog"
└── p → "I never closed the h1 above, ..."
An easy way to remember it: HTML is the recipe, the DOM is the dish. The browser "cooks" my file into something it can display — and something JavaScript can read and change later, which matters a lot for the fullstack part of this journey.
One detail worth knowing: the DOM is not always a perfect copy of the HTML I typed. Remember the browser's "guess and fix" habit from earlier? Those silent repairs are baked into the DOM. That's why the browser's element inspector sometimes shows structure you never actually wrote. (To see the original file instead, use your browser's "view source" — Ctrl + U in Chrome on Windows.) If you want to go deeper, MDN's DOM introduction is excellent.
4. Debugging with DevTools: Elements and Console
- Press
F12(Windows/Linux) orCmd + Option + I(Mac), or - right-click anything on a page and choose Inspect.
The Elements tab shows the live DOM tree. You can click a node to select it, edit its text right on the page, and see exactly which styles apply to it. It's the fastest way to answer "why does this look like that?"
The Console tab is where the browser talks back. Errors appear here in red — today's example was a 404 error, which means "I asked for a file at this address, but nothing lives there." That's usually a typo in an image path or a script URL. The console is also where console.log() messages show up, which is how developers peek inside their JavaScript.
| Tab | What it does | The question it answers |
|---|---|---|
| Elements | Shows the live DOM tree; click to inspect, edit to experiment | "Why does this look like that?" |
| Console | Shows errors and lets you run JavaScript | "Why is nothing working?" |
Everything you change inside DevTools is temporary. Refresh the page and it's back to normal — DevTools edits your page in the browser, not the files on your server. Think of it as a sandbox, not a save button.
Open this very blog post, press F12, switch to the Elements tab, and press Ctrl + F to search for the word "sandbox". Congratulations — you're inspecting the DOM of the page you're reading.
Key takeaways
- HTML syntax = elements (tags + content), with attributes tucked inside opening tags.
- Browsers forgive broken HTML, but their silent fixes can break your layout — a validator like validator.w3.org catches what the browser hides.
- The DOM is the live tree the browser builds from your HTML — and the thing JavaScript will control later.
- DevTools is a free debugger in every browser: Elements to inspect structure, Console to hear the errors.
All credits to freeCodeCamp for creating a great curriculum

























