December 29, 2011

A Look At Web Programming: Part 3



Getting Started


In this part, we’ll be creating a file with some HTML ( Hyper Text Markup Language ), saving it and running it in a browser.  It’s important to transcribe this code character for character in the beginning.  As you get the hang of HTML, you’ll be able to modify and create your own code to fit your needs.

Let’s begin by creating a simple HTML document.  In this document, we’ll specify:

  • a title
  • a header
  • a paragraph of text
  • a link


It’s always important to specify a goal before you start programming.  In this case, we’ll have a simple goal: create the traditional, introductory code for a “Hello World” document.

To start off, transcribe the following code into your text editor of choice:

<!DOCTYPE html>
<html>
<head>
 <title>Hello World!</title>
</head>
<body>
 <h1>Hello, World!</h1>
 <p>Lorem ipsum. Visit <a href="http://www.google.com">Google</a>!</p>
</body>
</html>



Save the file as “HelloWorld.html”. Make sure that the file is saved with the .html extension rather than a .txt extension.  Once you've saved it, open the file by either double-clicking it, or dragging it into the browser of your choice.
You should see something like this:
Likewise, the tab in your browser should have the title "Hello World".  Next, we'll inspect the document we have just written.

0 comments:

Post a Comment