Ch: 21 Web Authoring Notes 0417-IGCSE ICT 1
Definition and Usage
The <meta> tag defines metadata about an HTML document. Metadata is data
(information) about data.
<meta> tags always go inside the <head> element, and are typically used to specify
character set, page description, keywords, author of the document, and viewport settings.
Definition and Usage
The <base> tag specifies the base URL and/or target for all relative URLs in a document.
The <base> tag must have either an href or a target attribute present, or both.
Ch: 21 Web Authoring Notes 0417-IGCSE ICT 2
There can only be one single <base> element in a document, and it must be inside the
<head> element.
Example
Specify a default URL and a default target for all links on a page:
<head>
<base href="https://www.w3schools.com/" target="_blank">
</head>
<body>
<img src="images/stickman.gif" width="24" height="39" alt="Stickman">
<a href="tags/tag_base.asp">HTML base Tag</a>
</body>
Ch: 21 Web Authoring Notes 0417-IGCSE ICT 3
Definition and Usage
The <style> tag is used to define style information (CSS) for a document.
Inside the <style> element you specify how HTML elements should render in a browser.
Ch: 21 Web Authoring Notes 0417-IGCSE ICT 4
Definition and Usage
The <title> tag defines the title of the document. The title must be text-only, and it is
shown in the browser's title bar or in the page's tab.
The <title> tag is required in HTML documents!
The <title> element:
defines a title in the browser toolbar
provides a title for the page when it is added to favorites
displays a title for the page in search-engine results
Inline CSS
An inline CSS is used to apply a unique style to a single HTML element.
An inline CSS uses the style attribute of an HTML element.
The following example sets the text color of the <h1> element to blue, and the text color of
the <p> element to red:
Ch: 21 Web Authoring Notes 0417-IGCSE ICT 5
Internal CSS
An internal CSS is used to define a style for a single HTML page.
An internal CSS is defined in the <head> section of an HTML page, within
a <style> element.
The following example sets the text color of ALL the <h1> elements (on that page) to blue,
and the text color of ALL the <p> elements to red. In addition, the page will be displayed
with a "powderblue" background color:
Ch: 21 Web Authoring Notes 0417-IGCSE ICT 6
External CSS
An external style sheet is used to define the style for many HTML pages.
To use an external style sheet, add a link to it in the <head> section of each HTML page:
Ch: 21 Web Authoring Notes 0417-IGCSE ICT 7
HTML class Attribute
The HTML class attribute is used to specify a class for an HTML element.
Multiple HTML elements can share the same class.
Using The class Attribute
The class attribute is often used to point to a class name in a style sheet. It can also be
used by a JavaScript to access and manipulate elements with the specific class name.
In the following example we have three <div> elements with a class attribute with the
value of "city". All of the three <div> elements will be styled equally according to
the .city style definition in the head section:
Ch: 21 Web Authoring Notes 0417-IGCSE ICT 8
HT
ML id Attribute
The HTML id attribute is used to specify a unique id for an HTML element.
You cannot have more than one element with the same id in an HTML document.
Using The id Attribute
The id attribute specifies a unique id for an HTML element. The value of the id attribute
must be unique within the HTML document.
The id attribute is used to point to a specific style declaration in a style sheet. It is also
used by JavaScript to access and manipulate the element with the specific id.
The syntax for id is: write a hash character (#), followed by an id name. Then, define the
CSS properties within curly braces {}.
In the following example we have an <h1> element that points to the id name "myHeader".
This <h1> element will be styled according to the #myHeader style definition in the head
section:
Ch: 21 Web Authoring Notes 0417-IGCSE ICT 9