HTML & CS: Study Guide
1. The web and the roles of HTML/CSS
HTML (HyperText Markup Language) defines the structure and meaning of web
content. It marks up
headings, paragraphs, navigation, images, links, forms, and other elements.
CSS (Cascading Style Sheets) controls presentation: colors, typography, spacing,
borders, layout, and
responsive behavior. JavaScript is commonly used to add behavior and interactivity.
How a browser uses them
• The browser requests a page from a server or opens a local file.
• It parses HTML into a document structure called the DOM (Document Object Model).
• It reads CSS rules and determines the styles that apply to elements.
• It calculates layout, paints pixels, and displays the page.
HTML and CSS are not programming languages in the same sense as JavaScript or
Python: HTML is a markup
language, and CSS is a style-sheet language. Both are essential technologies for front-
end web development.
A minimal document
<!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>
</head>
<body>
<h1>Welcome</h1>
<p>This is my first web page.</p>
</body>
</html>
Why these lines matter: the doctype selects standards mode; lang identifies the
document language; charset
supports Unicode text; the viewport meta tag helps the layout match the device width;
and title supplies the
browser-tab title.
Common mistake: placing visible page content inside the head element. Most visible
content belongs inside
body.
2. HTML structure and semantic markup
An HTML element usually consists of a start tag, content, and an end tag. Some
elements, such as img and
input, are void elements and do not have closing tags.
<p>This is a paragraph.</p>
1. The web and the roles of HTML/CSS
HTML (HyperText Markup Language) defines the structure and meaning of web
content. It marks up
headings, paragraphs, navigation, images, links, forms, and other elements.
CSS (Cascading Style Sheets) controls presentation: colors, typography, spacing,
borders, layout, and
responsive behavior. JavaScript is commonly used to add behavior and interactivity.
How a browser uses them
• The browser requests a page from a server or opens a local file.
• It parses HTML into a document structure called the DOM (Document Object Model).
• It reads CSS rules and determines the styles that apply to elements.
• It calculates layout, paints pixels, and displays the page.
HTML and CSS are not programming languages in the same sense as JavaScript or
Python: HTML is a markup
language, and CSS is a style-sheet language. Both are essential technologies for front-
end web development.
A minimal document
<!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>
</head>
<body>
<h1>Welcome</h1>
<p>This is my first web page.</p>
</body>
</html>
Why these lines matter: the doctype selects standards mode; lang identifies the
document language; charset
supports Unicode text; the viewport meta tag helps the layout match the device width;
and title supplies the
browser-tab title.
Common mistake: placing visible page content inside the head element. Most visible
content belongs inside
body.
2. HTML structure and semantic markup
An HTML element usually consists of a start tag, content, and an end tag. Some
elements, such as img and
input, are void elements and do not have closing tags.
<p>This is a paragraph.</p>