HTML5, CSS3, and JavaScript Fourth Edition

(Ben Green) #1

CHAPTER 3. HEAD SETS THE STAGE 27


This specifies that the webpage is written in HTML, and more particularly
in the HTML5 dialect. If we do not specify it, the browser will just guess
what version of HTML we are writing in.


Exam Question 27(p.338): What is the first markup element of every
HTML5 webpage?
Required Answer:<!DOCTYPE html>


3.5 Head


Every HTML document is required to have exactly oneheadsection. This
is where we tell things “about” our webpage, such as its title, its description,
its internal style sheet, and the external resources it needs.


Optional: start of head.The next piece of a webpage after the doctype
introduces the head section. It looks like this:



This specifies the start of the head, and also that the webpage is written in
the “en” (English) language.


Exam Question 28(p.338):What is the second markup element of every
HTML5 webpage?
Acceptable Answer:...


It is optional because if we provide header material such as the character set
or title, but without explicitly beginning our head, the browser will pretend
that we typed. I recommend you have an explicit head.


3.5.1 Character Set


One of the first things the browser wants to know about our page is what
character set we are using. We will use UTF-8, but there are other character
sets that are desirable for languages like Chinese, Japanese, and Korean, for
instance.


Required: charset. Inside the head, we must specify the character set.
Charset is a required element in the head. It is specified like this:



Utf-8 stands for UCS Transformation Format, 8 bit. There are other charac-

Free download pdf