Chapter 1. Anatomy of an HTML Page

HyperText Markup Language (HTML) is the language of the Internet. The web server uses it to communicate the structure of the page to the browser, and it is the language that all browsers use to render pages. Therefore, it is very important that you are familiar with HTML.

HTML defines only the structure of a page. It does not define how a page looks when it is viewed. Cascading style sheets (CSS) are used to define the styles on a page. I talk more about CSS in Lesson 3.

Figure 1-1 shows the default markup that is generated when a new HTML page is created using Microsoft Visual Web Developer 2010 Express.

FIGURE 1-1

Figure 1.1. FIGURE 1-1

As you can see, the default page begins with a DOCTYPE declaration and is followed by the HTML element.

DOCTYPE DECLARATION

The DOCTYPE declaration tells the browser the exact version of HTML the browser should use to render the page. If you do not include the DOCTYPE declaration, the browser must guess which version of HTML to use. All modern browsers have multiple modes that correspond to the different versions of HTML, and the mode that the browser uses is determined by the DOCTYPE declaration. Therefore, for the browser to render your pages correctly, the DOCTYPE declaration must appear at the top of every single one of your web pages.

This is the default DOCTYPE declaration that Microsoft Visual Web Developer 2010 Express uses: ...

Get ASP.NET 4 24-Hour Trainer now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.