OCR Computer Science Guide — HTML, CSS, JavaScript.


HTML Tags

Tag name

Description

Example (if relevant)

<html> </html>

All website code is enclosed between a pair of html tags.
They store all the other code.

<head> </head>

Any code that doesn't directly appear inside the webpage is stored between the head tags.
This includes style and title tags.

<title> 1.3.4.a Guide for OCR Computer Science </title>

The title tag stores the name of the tab, which is displayed at the top of the browser.
The title tags are enclosed within the head tags.

[See the name of this tab]

<body> </body>

All content that is displayed directly to the user is stored between the body tags.

<p> I'm sorry, Dave. I'm afraid I can't do that. </p>

p tags are used for displaying paragraphs of regular text

I'm sorry, Dave. I'm afraid I can't do that.

<h2> Example (if relevant) </h2>

Heading tags are used for storing important text at a size that is usually larger and with different formatting.
Heading tags range from h1 to h6, with larger numbers signifying lesser importance/size.
Heading tags are also used by search engines when summarising and indexing your page.

[See the heading for this column]

<img src="Bliss_(Windows_XP).png" alt="Bucolic Green Hills" height="241" width="300">

Image tags are used to add images to webpages.
Image tags do not require end tags.
The source attribute is mandatory, and it can either be the name of a file which is stored in the same folder as the webpage, or a link pointing to that file.
The alternative text attribute is also mandatory, and it contains a description of the image to help those using assistive technologies, like screen readers.
The height and width attributes are not mandatory, and "auto" can be used in place of a number for one of these attributes so that the aspect ratio is maintained regardless of changes made to the other attribute.

Bucolic Green Hills