HTML

HTML is the structure of a web page and CSS is its finish, the way a house has framing and paint, and good CSS needs solid HTML underneath it.

Novice · HTML · CSS · Updated

By

After this lesson you can

  • Tell whether a part of a web page is HTML's job (structure and content) or CSS's job (how it looks)

Key takeaways

  • HTML gives a page its structure and content, like the foundation and framing of a house.
  • CSS gives a page its look, like the paint and finishing carpentry of a house.
  • Build solid HTML first. CSS can only make a page beautiful when the structure under it is sound.

I like to think of building a web page like building a house. A good house must have a solid structure: a foundation, framed walls, a roof, floors, and stairs.

A house under construction with only its frame up: the structure comes first, like HTML

A solid foundation and framing are essential to building a house that will last. After the house is framed, and the electrical, plumbing and walls are completed, it's time for painting and finishing carpentry.

A finished living room with paint, furniture and decoration: the finish that goes on last, like CSS

HTML is like the concrete foundation and framing of your page, and CSS is like the finishing carpentry of the site.

Just like it is impossible to have beautiful finish work in a house without a solid foundation, it is critical to also have a solid HTML foundation for your website that CSS can build on to create a beautiful design.

Do it: add the kitchen to the house's page

A builder keeps a page for the house going up on Maple Street, one heading and one line for each room that's finished. The kitchen was framed this week, but the page doesn't show it yet. The painter's work, the CSS, is already done: every room's heading and line get their colors from it. Your job is the structure:

  • A heading for the new room, Kitchen, made the same way as the other rooms' headings, after the bedroom.
  • Right under it, the kitchen's line: An island, a big sink and a window over the stove.
  • Leave the look to the CSS: write no colors or styles in the page. The kitchen gets the same paint as the other rooms by itself.

Copy the way the other rooms are written. Each piece of the page sits between a pair of labels in angle brackets; you'll learn all about them in the lessons ahead.

Practiced live on the lesson page: write the HTML right there and check it.

Check yourself

2 questions to try on the lesson page.

So what

Every web page you build has both halves: get the HTML structure right first, and the CSS has something solid to dress up.

Key terms

Cheat sheets