A Quick Introduction to HTML

0
21


HTML (Hypertext Markup Language) is the lingo of the internet. It is the medium for web designers to essentially explain to web browsers how to present information to users of the Internet. Using a reference to the former predominant information medium, newspapers, you can think of HTML in the context of a newspaper editor determining the typesetting and layout for an upcoming circulation. The design staff would spell out page formats for various parts of the newspaper by determining fonts, positions, image locations, section layouts and other details. The delivered product would be the result of the determination by the designers to use a size 50, Times New Roman font for the newspaper’s title, to include certain pictures and captions associated with stories and headlines, and to organize other aspects of the newspaper’s layout according to a model.

HTML works similarly. The vocabulary understood by browsers includes markup tags such as

<b></b> to bold text, <u></u> to underline text, </p> <p> to create a new paragraph, and

    /

  • to create lists. HTML obviously has much more capability than a newspaper. The ability to quickly move between pages by following web links is a major advantage that web pages and the internet in general offer as an information medium. Anyone who’s used the internet to check email, make a payment, or look up an address or phone number knows that HTML and related web technologies facilitate significant interaction between the user and the information supply.

    A Simple Example

    This exercise will give you a basic introduction to how HTML works. On your computer open the Notepad program by going to Start Menu->All Programs->Accessories->Notepad. When the Notepad editor comes up, type (or paste) the following:

    <b></p> <p></p> <h2>My First Web Page</h2> <p></b></p> <p>This text makes up the first paragraph. You can’t see the paragraph tag itself, but you can tell that this section of text is set off from the next section of text by a paragraph tag. The browser doesn’t show the tags themselves. Instead, it uses the tags as instructions on how to present the information.<b> </p> <p></b>This is another paragraph. By default the text in this paragraph is separated from the previous paragraph by a line of white space, so that it appears double-spaced, similar to how two paragraphs would be separated in a typical document.<b> </p> <p>Enter text here: <input type="text" width="50"></p> <p></b><br /> <b> </p> <p>What&#8217;s your favorite food?</p> <p><select><option>Hamburgers</option><option>Pizza</option><option>Mac and Cheese</option></select></p> <p></b>

Now save the file using the name “html-example.html”. After you save the file, open a web browser (Internet Explorer and Firefox are the two most popular), then open the file you just created by using the File->Open… or File->Open File… command in the browser.

So how did all those tags turn into what you see in your browser? I will explain.

HTML Tags

HTML segments are typically opened by a start tag and closed by an end tag. The first tag you’ll see in an HTML page is the

tag. At the end of the page, you’ll see a tag like this

. The ‘/’ included in the end tag tells the browser, “This is where the html tag ends.” Although it isn’t always necessary to close all HTML tags that have been opened, it’s best to explicitly provide a closing HTML tag for each tag opened. HTML tags can be, and very often are, nested inside of other tags. For example, every HTML tag on a page is nested inside of the

tag.

There are two main tags that divide an HTML document into its major sections. After the

tag is the tag. The information enclosed in the tag normally deals with describing what the HTML page is about. In our example, you see a tag enclosed within the section. You notice that the text inside the tag is displayed at the top of the browser, but not actually in the main section of the web page itself.

HTML

-> Head

-> Body

The

tag is the section that contains the functional content of the web page. Most of the interaction between a web page and its users occurs in the section of an HTML document.

Common HTML Tags

Following our example above, the paragraph (

</p> <p>) tags tell the browser to set off the text contained within them as separate paragraphs. You’ll notice that there is a line of white space between the first and second paragraphs on the page. That’s because the browser is following the formatting standard for </p> <p> tags.

The last two items included in our example HTML document are interesting. To allow for interaction between the user and the web page, various kinds of user input tags exist as part of the web markup language. The first one in our example,

<input type="text" width="50">, allows the user to enter text that can be sent to the web server and processed. The ‘type’ attribute of the <input> tag tells the browser which kind of input box to create. The ‘width’ attribute of the <input> tag tells the browser how many characters wide the input box should be.

The last item in our HTML example, a drop-down box, is created using the

<select></select> tag and associated

Leave a Reply