HTML = HyperText Markup Language. It's not a programming language β it's the structure of a page. You describe what things are (a heading, a list, a table), and the browser draws them.
A tag wraps content and gives it meaning. Most tags come in an open + close pair, and the closing tag has a slash.
li β tr also changed the letters
li inside words: "Library" became "trbrary", "Rowling" became "Rowtrng".
Find & Replace is a chainsaw, not a scalpel. Search for <li>
(with brackets) or turn on Match Whole Word.
Every HTML file starts with the same bones:
<!DOCTYPE html>
<html>
<head>
<title>City Library</title>
</head>
<body>
<h1>City Central Library</h1>
</body>
</html>
<head> = invisible metadata. <body> = visible content.<p> paragraph inside <title>.
Nothing showed up, because <title> lives in the invisible <head>.
Rule of thumb: if you want to see it, it goes in <body>.
| Tag | What it is |
|---|---|
<h1> β¦ <h6> | Headings, biggest to smallest |
<p> | A paragraph of text |
<ul> / <li> | Unordered (bulleted) list + list items |
<ol> / <li> | Ordered (numbered) list β browser numbers it for you |
<a href="..."> | A link to another page |
<!-- ... --> | A comment β ignored by the browser, notes for you |
<ol>, never type "1." "2." yourself β the browser does it. Add or remove
an item and everything renumbers automatically.
Extra info tucked inside the opening tag, written as name="value".
<a href="members.html">Members</a>
Here href is the attribute name and "members.html" is its value β the
page the link points to. Attributes are how one tag does many different jobs.
<a> and href?
<a> stands for anchor β it anchors one spot to another, like
dropping an anchor that ties you to a place. href = hypertext
reference β literally "the reference (address) this link points to." The names are
abbreviations of what they do.
Three tags nest together to make rows and columns:
<table> β the whole grid (outer box)<tr> β one table row<th> β a header cell (bold) Β· <td> β a data cell<th>; data rows use <td>.Forms collect input from the user. The key players:
| Tag | Job |
|---|---|
<form> | Wraps all the fields together |
<input> | One field. Self-closing β no </input>! |
<label> | The caption next to a field |
<button> | Submits the form |
The type attribute changes what an input accepts:
type="text"
type="email"
type="number"
A label's for must match the input's id. Same value on both sides = linked.
<form>
<label for="fullname">Full Name</label>
<input type="text" id="fullname">
<button>Register</button>
</form>