A web page is built from HTML for structure, CSS for style and JavaScript for behaviour.
HTML stands for HyperText Markup Language and describes the structure of a page. The <body> element holds the visible content and <title> sets the browser-tab title.
Headings run from <h1> downwards, <p> marks a paragraph and </p> ends it. <img> adds an image, with src giving the file location. <a> makes a link, with href giving the destination.
<ul> starts a bulleted list and <ol> an ordered one, with <li> for each item. <tr> creates a table row and <button> a button.
CSS controls how a page looks. A class is selected with a full stop, as in .card, and an id with a hash, as in #menu. The color property sets text colour.
The alt attribute gives alternative text for an image, which matters to anyone who cannot see it. Using heading levels in order gives the page a structure that can be navigated.
JavaScript adds interactivity. if begins a condition, // starts a comment, and === tests strict equality. Round brackets call a function.
console.log() writes to the browser console, document.getElementById() selects an element, and addEventListener() connects an event such as a click to the code that handles it.
A page is planned before it is built, deciding what content is needed and how it will be arranged.
A page is made for particular people. Its design should follow what they need, and testing it with them shows whether it does.
Back to Web Development practice ยท View all Web Development questions