HTML and CSS are the foundations of web pages. HTML gives content structure and meaning; CSS controls its presentation, including colour, spacing and layout. Learning both helps you build pages, customise templates and understand why a design behaves differently at different screen sizes.
You can start with a text editor and a browser. You do not need to master every feature before making your first page: begin with a heading and a paragraph, then improve the result one change at a time.
What is HTML?
HTML stands for HyperText Markup Language. It is a markup language, rather than a general-purpose programming language. Elements identify parts of a document, such as headings, paragraphs, lists and links. For example, <p> opens a paragraph and </p> closes it.
Understanding that structure is useful even when you work in a content management system such as WordPress. You can recognise a misplaced heading or an incorrectly nested element instead of trying random formatting changes. Practise on a local page or a test copy before editing a live website.
The document head and body
The <head> contains information about the document, such as its title, character encoding and a link to a stylesheet. It is different from <header>, which can mark an introductory area within the visible page. The <body> contains the page content.
The document title appears in the browser tab. A meta description describes the page; it is not visible body copy. A viewport setting helps mobile browsers use the device width, but it does not make an otherwise fixed-width layout responsive by itself. See MDN’s guide to document metadata for more detail.
Save this original practice example as index.html:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width,
initial-scale=1">
<title>My first page</title>
<link rel="stylesheet"
href="styles.css">
</head>
<body>
<h1>My learning journal</h1>
<p>Today I built a web page.</p>
<h2>Next steps</h2>
<p>
Keep <strong>practising</strong>.
</p>
</body>
</html>
Headings, paragraphs and important text
Use <h1> for the main page heading, then <h2> for sections and <h3> for subsections. Choose heading levels for the document’s hierarchy, not just to make text larger. In the example, “Next steps” is a section within “My learning journal”.
A <p> element identifies a paragraph; its spacing is controlled by CSS, not a fixed promise of two line breaks. <strong> marks important text and is usually displayed in bold. In our example, the word “practising” is important within the second paragraph.
For more examples of tags, attributes and nesting, use MDN’s HTML syntax guide.
What is CSS?
CSS stands for Cascading Style Sheets. It is a stylesheet language that controls how HTML content is presented. A rule selects elements and assigns property values: for instance, it can change every main heading’s colour without changing the heading text.
Save this as styles.css in the same folder as index.html:
body {
font-family: sans-serif;
line-height: 1.6;
max-width: 40rem;
margin: auto;
padding: 1rem;
}
h1 {
color: #01959e;
}
strong {
color: #2d3139;
}
Open index.html in your browser. You should see a teal main heading and comfortably spaced text. On a wide screen, the content stops growing at the maximum width; on a narrow screen, it fits the available space. Change the heading text in HTML, then change the colour in CSS, saving and refreshing after each edit.
What about HTML5 and CSS3?
“HTML5” remains a familiar label in courses and older tutorials, but current HTML is maintained as the WHATWG HTML Living Standard. Learn current HTML features rather than treating HTML and HTML5 as two unrelated languages.
Likewise, “CSS3” is not a separate language you must switch to for responsive design. Modern CSS develops through individual modules with their own levels, as explained in MDN’s CSS reference. Layout, colour, animation and other features evolve independently; check browser support for the particular feature you intend to use.
Why learn HTML and CSS?
- Build and customise pages: make deliberate changes to content structure and presentation, even when a template provides the starting point.
- Troubleshoot more confidently: separate a missing element or incorrect nesting from a styling problem.
- Understand responsive design: test how text and layouts adapt to available space, rather than assuming a page that looks good on your monitor works everywhere.
- Prepare for further development: HTML and CSS provide a useful foundation before adding interactive behaviour with JavaScript.
For a broader career and skills roadmap, read our guide to becoming a web developer.
How to practise effectively
- Create the two files above in a new practice folder. Check the filenames carefully, including their extensions.
- Change one thing at a time and refresh the browser so you can connect the code to its effect.
- Add a second section with a heading and paragraph, keeping the heading order logical.
- Resize the browser and test at a narrow width. Check that the text remains readable without horizontal scrolling.
- If the styling does not appear, check that the stylesheet filename and link match. If the structure looks wrong, check opening and closing tags.
Build This Skill
For guided practice, explore Academy Class’s Web Developers Masterclass Silver. Review the current syllabus and prerequisites to see how its web fundamentals training fits your starting point.