HTML and CSS Reference
In-Depth Information
If you're familiar with HTML4 and describing the document type, you know that you can add
a great deal of detail to tell the browser what's up with your page. So, the i rst tag that you
need to consider is not really an HTML tag but instead a tag that communicates with the
browser to tell it that you're writing HTML5 and not one of the many versions of HTML4 or
XHTML. Here it is:
h at's it! Nothing fancy, it just announces to the browser, “You can expect an HTML5
document type.” Every Web page you make should begin with that tag, and you do not need a
closing tag. h e exclamation mark ( ! ) tells you it's not an HTML tag, but something a little
dif erent.
Right at er the i rst tag that tells the browser what it can expect, you begin your HTML
container (everything between the opening and closing tags). h is tag announces the begin-
ning of HTML code and ends when the browser encounters the closing tag. h e closing
HTML tag is at the end of every HTML page.
Following the HTML element is the <head> container. h ink of the head area as the house-
keeping portion of a page. Whatever is in the head will be loaded i rst, no matter where it's
used in the rest of the HTML page. To get started, all that's going into the head is the page's
title. h e title appears at the top of the Web page when you run it. For example, consider the
following title:
< title > Seriously Sweet Page </ title >
h at title appears on the page's Windows and tabs. If you don't put it in, you'll end up with a
blank or default title. Figure 2-1 shows how the title appears in dif erent browsers.
As you can see, the title Seriously Sweet Page appears in dif erent places on the four main
browsers. On some, it appears at the top of the window and the tab, only at the top of the
page, and only on the tab. h is helps the user i nd your page when multiple pages are open
simultaneously — or simply reminds the user which page he's viewing. Lots of other content
goes in the <head> container, such as CSS and JavaScript, but for now, just remember to
include a title.
Moving right along, the <body> tag demarcates the beginning of the page's content. As the
name implies, the body is the main part of any Web page, and only content inside the
<body> container is visible on the page. Between the opening and closing body elements,
you put everything you want on your page. h e following set of tags should go on every page
you create — in fact, you might as well use it as a template and save it somewhere so you don't
have to start of with an empty page to code.
Search WWH ::

Custom Search