Getting started
- Beginner web design
- Web design software
HTML & CSS
- HTML beginner
- CSS beginner
- HTML advanced
Server & hosting
- Web hosting guide
Your first web pageCreating your first web pageAnd now it's finally time to jump into the HTML coding and create your very first web page!
XHTML 1.0 strict template:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>My first web page!</title> </head> <body> <p>Hello there ...</p> </body> </html> Viewing your web pageOur HTML code won't do much by itself and is pretty much just a text file. To see the web page it describes we're going to have to open it in a web browser.
You should now see a page similar to this: ![]() Your first web page
Analyzing your web pageFirst let me tell you that the code I gave you above is as super correct as it gets and follows the W3C XHTML 1.0 specifications to the letter. You can safely use it as a XHTML 1.0 strict template for all your future web pages. Doctype:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
This first line is not a real HTML tag, nonetheless it is required in every HTML document. This so-called doctype tells the web browser what kind of file it's dealing with. In our case it's a XHTML 1.0 strict file. These doctypes are set in stone and can always be looked up so please save yourself the torture of learning this by heart. html element:<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
... </html> This is where our actual HTML document starts. The head element:<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>My first web page!</title> </head> Next follows the head of our HTML document. Except for the title element which appears in the browser window, none of the head information is displayed on the page. The head usually carries information like language, character encoding, copyright information, page description and so on. The meta tag in our code is optional but should be included anyway as a backup in case the server is not providing this information or you're viewing the page offline. body element:<body>
<p>Hello there ...</p> </body> This is where things start to get interesting. The body element holds all the content that will be displayed as a web page. In this case we have a paragraph element with the text Hello there ... In the following chapters you'll get to know more of these HTML tags you can use to build your web page. Practice makes the masterThe best way to learn how to create a website is the do-it-yourself approach. I suggest you try out all tutorial examples in your own page and play around with the code to get a better understanding of how things work. |