Lesson 01 · 12 steps
The first page of a site about Counter-Strike 2. Everything here lives in one file, main.html: how a document is built, attributes, headings, font styling and the characters HTML keeps for itself.
<html> <head><meta charset="utf-8"> <title> CS2 UA. Головна сторінка </title> </head> <!-- 2) назва сайту --> <p> CS2 UA — сайт про Counter-Strike 2 </p>
A document has two halves. head holds what nobody sees on the page: the encoding, and title — the label on the browser tab. body holds what a person actually reads.
The utf-8 line is not a formality here. Without it the browser has no idea the text is Ukrainian and shows a row of question marks instead of letters.
A document starts with <!doctype html>, and the html tag gets a language: <html lang="uk">. Skip the doctype and the browser falls back to a compatibility mode built for 1990s pages, where some sizes are measured differently.
<!-- 3) атрибути тега: align --> <p align="center"> Цей сайт про Counter-Strike 2 — командний шутер, у якому п'ятеро грають проти п'ятьох </p> <p align="center"> Тут зібрано все: мапи, зброя, економіка раунду та українські команди </p>
An attribute is a setting written inside the opening tag. Here align="center" centres the paragraph on the page.
align was dropped from HTML: centring is appearance, and appearance belongs in CSS (text-align:center). The assignment asks for it because the lesson is about attributes, not about layout.
<!-- 4) текст на одному рядку з тегом body --> <body> Counter-Strike 2 вийшла 27 вересня 2023 року і замінила CS:GO на рушії Source 2.
Where a line ends in the source makes no difference to the browser: text tucked straight after <body> and text on the next line come out the same. A line break in the code is not a line break on the page.
<!-- 5) вкладені теги, форматований текст --> <p> У матчі дві сторони: <b>терористи</b> закладають бомбу, а <i>контртерористи</i> їм заважають. </p>
Tags nest like boxes: b and i sit inside the paragraph. One rule only — close them in reverse order, last opened first closed.
<!-- 6) примусовий перехід на новий рядок тегом br --> <p> Раунд триває 1 хвилину 55 секунд. <br/> Закладена бомба вибухає через 40 секунд. </p> <br/> <p> Розмінувати бомбу можна за 10 секунд, <br/> а з кусачками — удвічі швидше, за 5 секунд. </p>
<p> is a paragraph, and browsers leave a gap between paragraphs. <br> is a break inside one paragraph, with no gap. The preview above shows both.
Empty <br> tags are no longer used to push blocks apart — that is what margin is for. The break survives for places where the line really is one thing: an address, a verse, a match score.
<!-- 7) заголовки h1 і h6 --> <h1> Карти, на яких грають турніри </h1> <p> Dust II, Mirage, Inferno, Nuke, Overpass, Ancient та Anubis — активний пул карт змінюється щороку. </p> <h6> Найстаріша карта пулу — Dust II, вона з'явилася ще в першій Counter-Strike </h6>
Six levels of heading are not six font sizes — they are the structure of the text. h1 names the page, h2 a section, and so on down. Browsers happen to draw them in shrinking sizes because that reads well.
Search engines and screen readers navigate a page by its headings, which is why a heading is chosen by meaning and never by which size looks nicer.
<!-- 8) кілька атрибутів в одному тегові --> <p align="right" title="Олександр Костилєв — український кіберспортсмен"> Найвідоміший український гравець — s1mple, снайпер київської команди Natus Vincere. </p> <p align="left" title="Major — головний турнір року в Counter-Strike"> Natus Vincere виграла Major у Стокгольмі 2021 року — перший Major для української організації. </p>
Attributes are simply listed, separated by spaces. title never appears on the page — it surfaces as a tooltip if you rest the mouse on the text for a second. Try it in the preview above.
<!-- 9) накреслення шрифту --> <p> Щоб підняти розмір на пункт, є <big>тег big</big>, а щоб опустити — <small>тег small</small>. </p> <p> <b>AK-47</b> і <strong>AWP</strong> — головна зброя терористів, а <i>M4A4</i> та <em>M4A1-S</em> стоять на боці контртерористів. </p> <p> Назви команд у таблиці турніру зручно писати <tt>моноширинним шрифтом</tt>, щоб колонки не з'їжджали. </p>
b and strong look identical and mean different things: b is just bold, strong is important. Same with i and em — slanted versus stressed. Browsers show the difference to the eye; strong and em also carry it to a screen reader, which changes its voice.
big and tt are gone from the language, and small survives with a new job — the fine print. Size is set with font-size and monospaced text is marked with code.
<!-- 10) спеціальні символи --> <p> Counter-Strike 2 © 2023 Valve Corporation </p> <p> Точність стрільби падає в русі приблизно на 70 %, тому стріляють зі стійки </p> <p> Розкид кулі: ± 2 градуси #1 постріл & § правила економіки </p> <p> Якщо гроші > 4750 — можна купити AWP, <br/> якщо гроші < 2700 — на AK-47 уже не вистачить </p> <p> Формула переваги в раунді проста: гравці<sup>2</sup> + економіка<sup>2</sup> </p>
Characters that mean something to HTML are written as a substitution: < for «less than», > for «greater than», & for the ampersand itself. Write them literally and the browser decides a tag has started. The rest go in by name (©) or by number (% — the per cent sign).
The sample in the assignment leaves the semicolon off — ©. Browsers sometimes guess correctly, but the rule is that every substitution ends in a semicolon; without it, whatever follows can be swallowed.
<!-- 11) виділення слів тегом span --> <p align="left"> <span style="color:red">C4</span> — бомба, яку терористи закладають на точці A або B. </p> <p align="left"> На <span style="color:blue">pistol round</span> обидві команди мають лише пістолети і 800 доларів. </p>
span does nothing on its own — it is an empty container around part of a line, there to be given a colour or a font later. Its sibling div is the same idea for a whole block.
Colour written into the tag (style="color:red") is the quickest way and the worst one for a site of any size: changing the shade means editing every single line. Lesson 2 moves it out into a file of its own.