HTML and CSS
HTML structures pages; CSS styles them.
About this topic
HTML (HyperText Markup Language) describes the structure and content of a web page using tags, such as headings, paragraphs, links, images and lists. CSS (Cascading Style Sheets) controls the appearance, including colours, fonts, spacing and layout. Together with JavaScript for behaviour, they form the foundation of web pages.
An HTML element usually has an opening tag, content and closing tag, for example a paragraph tag around some text, and tags can have attributes such as a link address or image source. Elements are nested to form a tree called the DOM. CSS rules have a selector and declarations, such as making all headings blue with a larger font size. Selectors can target tags, classes and IDs, and the cascade decides which rule wins when several apply.
Separating structure from style means you can change the look of an entire site by editing one stylesheet. Responsive design uses flexible layouts so pages work on phones and large screens. A common mistake is forgetting to close tags or using HTML for appearance instead of CSS. Another is confusing classes with IDs. Use semantic tags like header, nav and main, which also help screen readers and search engines.
Key ideas
- Tags and elements
- Selectors and properties
- Responsive design
Quick check
Use cases: where HTML and CSS helps
- Homework: review the key idea behind HTML and CSS before you start a problem set.
- Exam revision: use the quick check to test whether you can recall HTML and CSS without notes.
- Visual learning: play with the interactive lab to see how HTML and CSS changes when you adjust its inputs.
- Teaching a friend: explain HTML and CSS in your own words, then compare your version with the key ideas.
Computing ideas run phones, search engines, games and the wider internet.
Frequently asked questions
What is HTML and CSS?
HTML structures pages; CSS styles them.
What will I learn in HTML and CSS?
Tags and elements. Selectors and properties. Responsive design.
Is HTML and CSS part of Computer Science?
Yes. It is one of 80 Computer Science topics on LearnViz HighSchoolEdu, with 3 key ideas, a live animation and a quick check.
Does the HTML and CSS lab work on a phone or tablet?
Yes. The animation resizes to fit your screen and supports touch, so you can drag, tap and slide with your finger.
How should I study HTML and CSS?
Read the summary and key ideas first, play with the interactive lab to see the idea in motion, then answer the quick check. If you get a question wrong, go back to the key idea it tests.
Do I need an account, and is my progress saved?
No account is needed. Marking a topic as learned is saved in your own browser, so it stays on that device and is not sent to a server.