O'Reilly logo

D Web Development by Kai Nacke

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Solving common tasks

Having mastered the template basics, you will soon need to solve some common tasks. You will learn about the most common ones in the following sections.

Configuring the document type

The document type at the beginning of a page tells the browser how to render the page. All the previous examples used the doctype shortcut of HTML 5: <!DOCTYPE html>. If you need a different document type, then you have to choose between either using the built-in doctypes or custom doctypes. The following shortcuts are available:

Shortcut

Generated DOCTYPE

doctype html
<!DOCTYPE html>
doctype xml
<?xml version="1.0" encoding="utf-8" ?>
doctype transitional
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required