Dallas College, Richland Campus Multimedia Learning Center

Web Design 1

Introduction to HTML (Index Page)


References


What Is the Web?

"The Web" is short for "the World Wide Web". The Web is:

Here is some explanation for each of the above points:


Internet-based

Web browsers use connections and communication protocols that are based on TCP/IP (Transmission Control Protocol/Internet Protocol). These communication protocols and techniques are what make up the Internet. Web servers and browsers use the Internet to transfer requests and pages between computers.


Graphical

A browser is used to view and navigate Web pages and other information on the Web. Modern browsers can display both text and graphic images, including video and sound. The graphical capabilities of browsers are one reason that the Web has become so popular.


Distributed

There is so much information available on the Web that it would be literally impossible for you to read it all in one human lifetime. But where is all of this information stored? It is stored on thousands, maybe millions, of computers all over the world. This is the "distributed" aspect of the Web. Each of these computers is called a Web server, which means that the computer "listens" for requests from Web browsers and responds to those requests by sending Web pages to the requesting browsers.


Hypertext-based

The idea behind hypertext is that instead of your having to read text in a linear, start-to-finish manner, you can skip easily from one point to another point in the text simply by clicking on a link in the text.


Interactive

Interactivity is the capability to "talk back" to the Web server. The Web is inherently interactive; the act of selecting a link and jumping to another Web page is a form of your "talking" to the Web server. Also, when you fill in a form and send feedback to the webmaster of a site or order something on an eCommerce site, you are definitely giving instructions or feedback to that site.


Dynamic

The publisher of a Web site can update the content of their site just about any time they want to. Many sites automatically update their content based on the time of day, the part of the country you are accessing the site from, the latest news happenings, and such.


Cross-Platform

If you can access the Internet, you can access the World Wide Web whether you are working on a PC or a Mac; whether you have a high-end graphics workstation or an old clunker computer with a 14" monitor; and whether you connect with a 28k modem or with a DSL line. For the publisher of a Web site, this cross-platform capability of the Web is a huge headache, because of the differences among the various browsers and operating systems; but the capability is there nonetheless.


Global

Let's look at a few global Web sites:


Introduction to HTML

HTML stands for HyperText Markup Language. This markup language is a set of various special text instructions that tell a Web browser how to format and display information. These special instructions are called tags.

This is one of the things you need to keep in mind about a browser: it is a text processor that is designed to look for these special HTML tags and respond to what the tags are telling it (the browser). So your HTML pages are text files that have browser instructions (tags) in them, along with the information that you want to display.

Strictly speaking, HTML does not, by itself, tell the browser how the document will appear when the browser displays the document. It merely describes what is in the document. HTML has been "extended" by the browser makers to include formatting tags such as <font> and <center> to control the appearance of the page. But these "extension" tags are being phased out. The preferred way of controlling the appearance of the document is with Cascading Style Sheets (CSS), which you will see later in this course.

To reiterate: A browser is a text processor. What this means is that an HTML page is a text file, and the browser parses the page and formats the document based on the HTML commands (tags) that it finds. Parsing means analyzing and separating something (in this case, an HTML page) into its components (in this case, the tags and content of the page).

Let's review briefly the process by which a browser obtains and displays a Web page:

  1. The user requests a page, either by typing the URL into the "Address" box of the browser, or by clicking a hypertext link in another page.
  2. The browser sends a message to the closest available Domain Name Server (DNS) computer. The DNS translates the URL in the message into an Internet Protocol (IP) address, which is the network address of the requested page's Web server.
  3. The DNS forwards the message to the Web server, asking for the page that the user has requested.
  4. The Web server locates the page and sends it back to the browser in another message.
  5. The browser parses the message into its parts and then figures out what will be on the page, and where, based on the tags and formatting rules.
  6. The browser also applies any Cascading Style Sheet (CSS) formatting rules that it finds for the page. We will look at stylesheets in the next class session.
  7. The browser displays the page.


Tags

Each HTML tag consists of the markers (containers) that start and end the tag, and the HTML command that is in the tag. (An HTML command is an instruction to the browser to do something.)

The tag markers are the less-than symbol (<) and the greater-than symbol (>). Here is an example of an HTML tag:

  <div>

Regular Tags

Each regular HTML command has a part that "starts" (or "opens") it and another part that "ends" (or "closes") it. A tag like the one shown above, the <div> tag, is an "opening" tag, (it turns "on" the division command); and it has a corresponding "closing" tag (it turns "off" the division command) that looks like this:

  </div>
Notice the forward slash (/) just inside the beginning of this "closing" tag.

Self-Closing Tags

Some HTML commands do not have a corresponding "closing" tag. These tags are called "self-closing tags". An example of a self-closing HTML tag is the "break" tag, which looks like this:

  <br>

You can look at an HTML reference page to see which tags are self-closing. For quick reference, here is a list of some of the most common self-closing tags:


Choosing an Editor

In order to make an HTML Web page, you will need a text editor app or program which can save the document in plain text format.

If you are using a Windows PC or laptop, I recommend one of these editors:

If you are using a Mac or Macbook, here are some editors that you can try:


White Space

When you are typing the HTML "source" code for your Web page, such as the code displayed above, you can put as much or as little "white space" in your source code page as you wish. "White space" is the term for things that you type into your page so you can more easily see what tags are in the page, but which do not display on the Web page itself. Some of these "white space" characters are:

I highly recommend that you use as much "white space" as you need to easily see what tags are in your page. The browser will "eat" most of the white space anyway. More on that later.


Basic Document Structure

An HTML page has two main sections:

The head section contains information about the page. The information in the head section is used by the Web server and the browser. The person who is viewing your Web page does not see any of the information in the head section -- except for the text that is in the <title>...</title> tag.

The body section contains the information, images, videos, and other things that you want to display to the person who is viewing your Web page.

Here is a basic (although not minimal) structure that a valid Web page can have. Please note that this page shown here is an HTML5 page. HTML5 is much simpler and more straight-forward than the previous version of HTML, which was XHTML:

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Page Title</title>
  <meta charset="UTF-8">
  <meta name="description" content="Introduction to designing and making Web sites">
  <meta name="keywords" content="Web Design,HTML,CSS">
</head>

<body>

<div>
  <header>
     <h2>Page Heading</h2>
  </header>
  <section>
     <h3>Section Heading</h3>
  </section>
  <footer>
    <p>&copy; Copyright 2019</p>
  </footer>
</div>

</body>
</html>

<!DOCTYPE>

This tag is required to tell the Web server and the browser what kind of page this is. The tag shown here is an HTML5 DOCTYPE tag.


<html lang="en">

This tag starts the HTML page itself.

The W3C has changed its thinking about how a browser should determine what language the page is using. Now the W3C wants the page to include a lang attribute in the <html> tag.


<head>

This tag starts the "head" section of the HTML page. The "head" section contains some other HTML tags.

The various tags that are located within the <head> section are called nested tags because they are contained by another tag -- in this case, the <head> tag (and the </head> tag, of course). Most of the information in the <head> section is about the document (meaning, this HTML page) itself, and is used by the Web server and the browser.

The tags most commonly used in the <head> section are:

<title>

This tag starts the title of the page. The text in the title tag is what shows up in the title bar of your browser when you view the page. This title information is also used by many search engines as the link to your page.

The information in the <title> tag is the only information in the <head> section that is visible to the user.

(You may see this tag occasionally referred to as a "title meta tag". Since it is in the head section, and it does give information about the page, it is somewhat conceptually a meta tag, but not in the sense that it is an actual <meta> tag. It is a <title> tag.)

Here is an example of a <title> tag:

  <title>
    Cheap Dates Rock Band - Tour Info, Photos and Song Lyrics
  </title>

</title>

This tag closes the title information for the page.


"charset" <meta> Tag

This tag provides information to the Web server regarding what character encoding your page is using.

This tag looks like this:
  <meta charset="UTF-8">

"description" <meta> Tag

This tag provides a brief (usually about two-line) description of the page. This information is used by the various search engines to provide the user with a brief "advertisement" for your site in the search-engine site listing.

This tag looks like this:
  <meta name="description" content="Introduction to designing and making a Web site">

"keywords" <meta> Tag

This tag provides a list of words and phrases that the various search engines use to categorize and/or index the contents of the site.

This tag looks like this:
  <meta name="keywords" content="Web design,HTML,CSS">

</head>

This tag closes the head section of the page.


<body>

The <body> tag follows the closing </head> tag. The <body> tag encloses the fun/relevant/visible part of your Web page.

You can use comments in your HTML pages to give yourself clues about what you have in your page, especially if your page is very long and has a lot of sections in it. HTML comments look like this:

<!-- You can use comments, like this one, to remind yourself of what you are putting into the page.  -->

Your content is contained by (meaning: inside of) the <body> tag. This requirement means that all of the other HTML tags that you put into the page are in the <body> tag.

For instance, if you wanted to add a paragraph tag to your page, you could put something like this in the body:


<div>

The <div> tag is the main generic "container" tag in a Web page. It may contain any other kinds of body tags, including other <div> tags.


<header>

The <header> tag contains content that is in the top part of the page.


<h1> through <h6>

HTML headings are a nice, simple way to emphasize portions of your text content. Also, some search engines give a bit more importance to text inside heading tags. But if you put too much text in heading tags, the search engines may penalize your relevancy rating, so don't overdo it!

Headings come in six sizes. The smaller the number in the heading tag, the larger is the heading. So heading 1 is the largest, and heading 6 is the smallest.

Here is how you code HTML headings:

  <h1>This is heading 1.</h1>
  <h2>This is heading 2.</h2>
  <h3>This is heading 3.</h3>
  <h4>This is heading 4.</h4>
  <h5>This is heading 5.</h5>
  <h6>This is heading 6.</h6>

And the above samples look like this:

This is heading 1.

This is heading 2.

This is heading 3.

This is heading 4.

This is heading 5.
This is heading 6.

Please note that headings automatically add a line of space above and below the heading. In this sense, they behave very similarly to paragraph tags (<p>...</p>). And in fact, headings are block display elements, just like paragraphs (and divs).


</header>

The </header> tag closes the "header" element.


<section>

The <section> tag contains related content for a meaningful/semantic/thematic portion of the page.


</section>

The </section> tag closes the "section" element.


<footer>

The <footer> tag contains content that is in the bottom part of the page.


</footer>

The </footer> tag closes the "footer" element.


</div>

The </div> tag closes the "div" element.


</body>

This tag closes the viewable content section of the page.


</html>

This tag closes the HTML page.


Other HTML5 Tags

Some other tags, which were introduced with the HTML5 Specification, are these:

Please note the following information about the <section> and <article> tags:

  1. The <section> tag is not a generic container tag. When a tag is needed for styling purposes or as a convenience for scripting, you should use the <div> tag instead. A general consideration is that the <section> tag is appropriate only if the tag's contents would be listed explicitly in the document's outline. What this consideration means in non-technical terms is that you should use a <section> tag in the page to contain information which directly contributes to the reader's understanding of the topic of the page.

  2. The W3C strongly recommends that both the <article> and <section> tags contain a heading (NOT <header>) tag. To quote this recommendation page, "As a general rule, include a heading (h1-h6) as a child of each section and article element." This recommendation is based on accessibility considerations. To quote the recommendation page again, "Screen readers expose the heading hierarchy of document to users by announcing the heading level (1 to 6) of each heading they find. During calculation of a document's outline, sections and articles with missing headings result in an outline with a malformed heading hierarchy in which some heading levels are skipped -- as the heading level of each heading reflects its outline depth." What this recommendation means in non-technical terms is that your <article> and <section> tags should contain an <h1>, <h2>, <h3>, <h4>, <h5>, or <h6> tag at the top of the article or section. We will talk about these heading tags a bit later in the semester.

Saving Your Page

Your site's main and/or initial page should be saved as filename index.html since most Web servers are set up to look for index.html as the default initial page of the site.

I recommend that you use the file extension .html since some servers are not set up to look for .htm. So save the first page of your site as index.html to be safe.

A word of caution and advice: Pay close attention to where (in what folder) you save your page, on your local drive/storage!

And now a HINT about changing how Windows Explorer (the Windows file manager) displays filenames: Use these steps to instruct Windows Explorer to display the full filename, including the extension:

  1. In the top menu of Windows Explorer, click Organize▾.
  2. Click Folder and search options.
  3. Click the View tab.
  4. Uncheck the checkbox for Hide extensions for known file types.
  5. Click OK.

Viewing Your Page

After you have saved your page to your computer or to some other storage device, you can use Windows Explorer (note: this is not Internet Explorer) to navigate to the page and double-click on the page's icon to open the page in a browser. Please note that when you view your page from your local storage (hard drive or some other storage device), you are not using a Web server to look at your page. You are using a browser, but not a Web server.


<br> and <p>

As I mentioned in a previous section, HTML pages are not displayed by the browser exactly as you type them into your text editor. This situation occurs because the browser "eats" certain characters such as spaces, carriage returns/linefeeds (Enter/Return), and tabs.

If you want the text displayed in your page to have a line break in it, you can use the <br> (break) tag to put in this line break.

For example, code like this:

  This is line 1.<br>This is line 2.
actually appears in the browser like this:

This is line 1.
This is line 2.

Note: If you are working in an older-style XHTML Web page, the break tag needs to have a closing slash in it, like this:

<br />


If you want your text to have a line break and a blank line between lines of text, you can either use two <br> tags or you can use a <p> tag.

For example, this code:

  This is line 1.<br><br>This is line 2.
appears in the browser like this:

This is line 1.

This is line 2.

And you can achieve the same effect with the <p> tag like this:

  This is line 1.<p>This is line 2.</p>
which looks like this in the browser:

This is line 1.

This is line 2.

But it is even better, and we will talk about this again later in the course, to structure these sample lines like this:

 <p>This is line 1.</p>
 <p>This is line 2.</p>

which looks like this in the browser:

This is line 1.

This is line 2.

Please note that each sentence above is fully enclosed by (contained by) its own set of <p>...</p> tags.


Attributes and Values

Many HTML tags can have attributes, and these attributes have values. HTML attributes give the browser more information about what the browser is supposed to do with the tag. When we talk about Cascading Style Sheets (CSS) next week, you will see that attributes are crucial to how style rules do their formatting of the page, also.

All attribute values must be enclosed in a set of quotes ( " " or ' ' ).


For example, the <p> tag (and most other HTML tags, also) can have an attribute called id. (We will discuss what this attribute is used for, later in the course.) It is used like this:

  <p id="firstParagraph">

Another attribute that can be used in many HTML tags is the class attribute. (We will discuss what this attribute is used for, later in the course.) It is used like this:

  <p class="standardParagraph">

You can have More than one attribute in a tag. For instance, you can have both the id and the class attributes in a paragraph tag. This situation would look like this:

  <p id="firstParagraph" class="standardParagraph">

Character Entities

You will see some weird characters in the <footer> section of the Basic Document Structure above: &copy;

These weird characters comprise what is called a "character entity" in HTML terminology.

A "character entity" is interpreted by the browser as a single character or symbol. In the document shown above, the characters &copy; are interpreted and displayed as the "copyright" symbol.

Character entities becomes very handy if you ever need to display the less-than symbol (<) in a Web page. The problem with simply typing "<" into your document is that the browser interprets the < as the beginning of an HTML tag!

For the <, you use the set of characters &lt; to tell the browser to display a less-than symbol (<), but not to actually consider it the start of an HTML tag. This particular character entity is extremely handy if you are trying to display HTML code in an HTML page, for instance.

There are many other character entities. Some handy listings of the available character entities for characters and symbols can be found at:


HTML Validation

You should check your HTML pages to make sure all of the tags are properly typed in. You have many ways to do so. The best, and standard, validator is the W3C Validator.

There is one "feature" of the W3C validator that you need to be aware of: It complains about files that are uploaded from a local hard drive. Specifically, it complains that it can't find any text encoding information, which is normally provided by the Web server.

You have two possible solutions:

  1. Check your file from a server, which transmits the text encoding information along with the page you are validating. This means that you would use the "Validate by URL" method of validating your files.
  2. Add a charset meta tag to your document's <head> section. This tag looks like this:
    <meta charset="UTF-8">
    If you add this <meta> tag, your document will validate from a local hard drive by using the "Validate by File Upload" method on the W3C site.


The Sitemap Page

Your site will eventually have a Sitemap page. The Sitemap page is an outline or list of all of the pages on your site.

Please NOTE: You don't currently have a Sitemap page. You will make this page later in the semester. (This seems like a good time to mention some general features of Web sites, which is why I mention it here.)

The Sitemap page of most Web sites has become a defacto standard page. There are two main reasons for your having a sitemap page in your site:

  1. It serves as a last-resort navigation page for the user to find things in your site, if your navigation is confusing or you have a very large site.
  2. The search-engine robot programs will index all of your site's pages if you have a link to all of them on the sitemap page.

So when you update your Web site, don't forget to update your sitemap page if you have added or deleted pages, and/or you have re-organized your site! See the next section for a detailed outline of the updating process.


The Process (including Uploading Your Page)

Now that you have created, saved, and validated your Web page, it needs to be uploaded to your Web server so other people can see it.

You can use your hosting service's File Manager if it has one. Following are some important hints regarding Freehostia's File Manager. (Other hosting services usually have a similar File Manager.)

The process of updating your Web site is not difficult, but you do need to pay attention to some important details.

Here is a brief list of the most important steps:

  1. If you are modifying existing web pages:
    1. Back up your site's local pages and resources (HTML pages, CSS files, images, sounds, etc.). (Please NOTE: You don't yet have all of these types of pages and files.)
    2. Start your File Transfer Protocol (FTP) program/app and connect to your site's remote hosting Web server, or log in to your hosting server's File Manager account pages.
    3. Navigate in both the local and remote file lists of your FTP program, to the directories that you want to work in; or find your site's pages in the hosting service's File Manager.
    4. Download the pages and/or resources that you want to update, to your local storage. This step is not strictly necessary if you have kept your local files in sync with your remote (site) files. Just to be sure that you are working with the current site's files, this step is a good idea. And this step is also one good reason for backing up your local files before you start!
    5. Make your modifications to the files and/or resources. While you making your changes, you should occasionally (say, every few months or so) make sure of these aspects of your site:
      • Have there been any technological changes that you need to address? Some of these changes might be:
        • An updated version of HTML
        • An updated version of CSS
      • Have there been any improvements and/or changes to website security that you need to incorporate?
    6. When you update your Web site, don't forget to update your sitemap page if you have added or deleted pages, and/or you have re-organized your site!
  2. VALIDATE the new and/or changed pages!
  3. Display the pages, if possible, in a local browser to make sure they look okay.
  4. Upload the new and/or modified pages and/or resource files.
    1. When you log in to your Freehostia account, you will see a panel with the heading "Manage your sites / databases".
    2. Click the "File Manager" icon/link.
    3. This next step is MOST IMPORTANT, and failure to do this next step is the main reason that students fail to properly upload their pages: You must double-click the URL of your site in the "File Manager" display. This double-click is necessary because Freehostia has the capability of hosting up to five different web sites on one account, and you need to be in the proper/desired web site before you upload your files.

      You can check to make sure you are in the correct folder, by looking at the "Path:" information in the File Manager. It should show something like /www/giraffesaretall.xyz (or whatever your site's URL is, following the /www/).
    4. After you have navigated to the correct site URL (see the above item), you will click on the big blue button that says "UPLOAD NEW FILE(S)".
    5. Now click on the small white button that says "Add Files".
    6. Locate and select the file(s) that you want to upload (which should be only index.html for this assignment) and then click "Open" (in most browsers).
    7. Finally, click the large blue "Upload" button.
  5. TEST your live Web site!
  6. BACK UP your pages!! (in several locations)

You can see your page on the Web server by selecting the "Student Sites" link on the class site and then clicking your Student Number in the bulleted list. Make sure you refresh/reload your page with F5 (or Ctrl+R) to see the new version of your page!

You can also type your site's URL into the address bar of your browser!