The chapter in short
Web pages are built with three languages. HTML gives a page its structure and content, CSS controls how it looks, and JavaScript makes it respond to the user.
The chapter covers the structure of an HTML document, common tags and attributes, links, images, lists, tables and forms; CSS selectors and properties; and JavaScript basics such as variables, functions and events.
HTMLTagAttributeCSSSelectorJavaScript
Key points
- An HTML page has <html>, <head> (with <title>) and <body>.
- Most HTML elements have an opening and a closing tag, such as <p>…</p>; attributes add information, such as href and src.
- <a href> makes a link, <img src> shows an image, <ul>/<ol> make lists and <table> makes a table.
- CSS can be inline, internal (in <style>) or external (in a .css file); external CSS styles many pages at once.
- A CSS rule has a selector and declarations: p { color: blue; }
- JavaScript runs in the browser; it can react to events such as a button click and change the page.
Definitions
- 1
HTML
HyperText Markup Language, used to structure the content of web pages.
- 2
Tag
A keyword in angle brackets that marks the start or end of an HTML element.
- 3
Attribute
Extra information about an HTML element, written in its opening tag.
- 4
CSS
Cascading Style Sheets, used to set the appearance of web pages.
- 5
Selector
The part of a CSS rule that chooses which elements to style.
- 6
JavaScript
A programming language that makes web pages interactive.
- 7
Hyperlink
A link from one web page or place to another.
Formulas
Page skeleton
<html><head><title>…</title></head><body>…</body></html>
CSS rule
selector { property: value; }