Flylib.com

Books Software

 
 
 

Reflection


Reflection

At this point, you might be tempted to say that you cannot learn these tags and can get along without using them by using one of the special HTML editors. The editors can help you, but these too require learning. They often throw in extra tags and inappropriate references for images and other files, making it difficult to move your project to a new computer. The biggest reason to learn the tags is that you will need to know HTML to write the PHP and ASP scripts to produce HTML. It really is not that difficult. Tags begin and end; you need to remember the opening and closing pointy brackets. You need to write attribute values, such as image filenames, and use quotation marks around them. You need to pay attention to opening and closing of tag pairs. If you fail to include a < /a > tag, for example, the rest of the document will be a link.

A problem in writing HTML that you might be wondering about if you have done any programming of languages such as C++ and Java is that no program catches what to you are obvious errors. Neither the text editor nor the browser catches an error, such as not including a closing tag or mistyping the tag for a level-one header as the letter h followed by the lowercase l. Instead, the browser always displays something. You need to look at the display and confirm that it is what you intended. If there are problems, you need to examine the source file to see what the error is. The browser is forgiving of errors. It also ignores things like improperly nesting tags:

<b><i>Italic and bold </b> </i>

You can also mix upper- and lower-case for the tags: < BODY > or < body > or < boDy > .

As we have indicated, the HTML system does not specify exact display. This can be unfortunate in cases when you really need to specify formatting. Technologies, products, and standards exist now to address some of the formatting issues. These include cascading style sheets (CSS), eXtensible Markup Language (XML), and eXtensible Stylesheet Transform (XSL). We mention these acronyms to give you terms for reference and will not address them in this book.

{% if main.adsdop %}{% include 'adsenceinline.tpl' %}{% endif %}

The HTML language is constantly evolving. One emerging standard is called XHTML, or extensible HTML. It requires us to be more careful about properly nesting the tags, using lowercase for HTML tags, and using quotation marks around all attribute values. We tried to do that in this text, but you might see examples elsewhere that do not follow these rules. Another rule of XHTML is that the so-called singleton tags, such as for line break and images, must contain a closing slash:

<br /> <img src="heart.gif" />

We do not follow that rule here because some of the older browsers actually complain. However, you might see this usage elsewhere.

There are more attributes for these tags and there are more tags. However, what you have learned so far provides substantial functionality. You can learn more tags by examining the HTML source code for existing pages. You see the source by using the View command on the browser toolbar and clicking on View Page Source, or by clicking the right mouse button and clicking on View Page Source. You can also use the Web to find online tutorials or references.

The next chapter will review client-side scripting using JavaScript and the HTML for forms.



Exercises, Questions, and Projects

  1. Define and describe the following terms: browser, tag, attribute, and source code.

  2. What do each of the following tags do ( indicate also whether the tag is used as the start of a pair and if the tag needs attributes): html, head, title, body, h1, b, i, img, a, table, tr, td?

  3. How do you do the following tasks ?

    1. Make text bold.

    2. Make text italic.

    3. Cause a line break.

    4. Indicate a paragraph.

    5. Insert an image of a file named  frog.gif .

    6. Insert an image and specify its dimensions to be 60 pixels by 80 pixels.

    7. Insert a table of three rows and two columns .

    8. Create a hyperlink to go to one of your favorite Web sites.

    9. Create a hyperlink to go another HTML file you will create in the same folder.

    10. Create a hyperlink in which an image is the link.

  4. Go on the Web and use a search engine to find online sources for HTML tags. Look up how to do these particular tasks: ordered list, font size , and frames .

  5. Go on the Web and use the View Source command in the browser to examine the HTML source for sites. Try to find simple ( non-database or XML driven sites).