HTML and CSS Reference
In-Depth Information
<title>My First Web Page</title>
</head>
<body>
<p>Hello World</p>
</body>
</html>
3. Save your index.html file.
Now open the index.html file in your favorite web browser by double-clicking the file on your desktop. To open
it in a browser other than the default one on your computer, right-click on the file and select a program from the
Open With menu. This is how you will access your web page files for all the examples in this topic.
You should see a page that looks like Figure 1-3.
Figure 1-3 Your first HTML5 web page.
If your web page doesn't look like the one in the figure, check that you typed all the code correctly. Make sure that
you check the spelling of the words within the angle brackets, too.
That's it! You have successfully created your very first web page. It really wasn't as hard as you thought it would be,
was it? I know, it's not very colorful or exciting, but that will come soon enough. First, let's explore this code a bit.
Constructing Elements
HTML web pages are made up of a number of elements ; think of these as the components of a web page. Each ele-
ment has a particular purpose; it might contain some text content, a heading, an image, or some information to be
used by the browser. The code in your example includes three main elements: an <html> element, a <head> ele-
ment, and a <body> element. Those elements in turn contain some other elements, such as a <title> and a <p>
(for paragraph) element. You learn more about each of those shortly.
In most cases, an element is made up of two tags, a start tag and an end tag. You may place some content between
these tags that will be displayed on the web pageā€”such as text, or even more elements. Each tag starts with a less-
than sign ( < ) and ends with a greater-than sign ( > ). End tags also have a forward slash ( / ) immediately after the less-
than sign so the browser can differentiate them from start tags and recognize the end of an element. Here is the
<title> element from the page you just created:
<title> My First Web Page </title>
Note the start and end tags (bolded here) with some text content in the middle.
Search WWH ::




Custom Search