HTML
  Home arrow HTML arrow Page 5 - Handling Hyperlinks and Images in HTML
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
HTML

Handling Hyperlinks and Images in HTML
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 3
    2008-04-03

    Table of Contents:
  • Handling Hyperlinks and Images in HTML
  • 2.8 Images Are Special
  • 2.9 Lists, Searchable Documents, and Forms
  • 2.10 Tables
  • 2.12 Stylesheets and JavaScript

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Handling Hyperlinks and Images in HTML - 2.12 Stylesheets and JavaScript


    (Page 5 of 5 )

    Browsers also have support for two powerful innovations to HTML: stylesheets and JavaScript. Like their desktop publishing cousins, stylesheets let you control how your web pages look--text font styles and sizes, colors, backgrounds, alignments, and so on. More important, stylesheets give you a way to impose display characteristics uniformly over the entire document and over an entire collection of documents.

    JavaScript is a programming language with functions and commands that let you control how the browser behaves for the user. Now, this is not a JavaScript programming book, but we do cover the language in fair detail in later chapters to show you how to embed JavaScript programs into your documents and achieve some very powerful and fun effects.

    The W3C--the putative standards organization--prefers that you use the CSS model for HTML/XHTML document design. All modern GUI browsers support CSS and JavaScript. The ancient Netscape 4 alone also supports a JavaScript Style Sheet (JSS) model, which we describe in Chapter 12, but we do not recommend that you use it. Let's rephrase that--don't waste your time on JSS. CSS is the universally approved, universally supported way to control how your documents might (not will) usually be displayed on users' browsers.

    To illustrate CSS, here's a way to make all the top-level (h1) header text in your HTML document appear in the color red:

      <html>
      <head>
      <title>CSS Example</title>
      <!-- Hide CSS properties within comments so old browsers
      don't choke on or display the unfamiliar contents. -->
       
    <style type="text/css">
          <!--
         
    h1 {color: red}
         
    -->
       
    </style>
      </head>
      <body>
      <h1>I'll be red if your browser supports CSS</h1>
      Something in between.
      <h1>I should be red, too!</h1>
      </body>
      </html>

    Of course, you can't see red in this black-and-white book, so we won't show the result in a figure. Believe us, or prove it to yourself by typing in and loading the example in your browser: the <h1>-enclosed text appears red on a color screen.

    JavaScript is an object-based language. It views your document and the browser that displays your documents as a collection of parts ("objects") that have certain properties that you may change or compute. This is some very powerful stuff, but not something that most authors will want to handle. Rather, most of us probably will snatch the quick and easy, yet powerful JavaScript programs that proliferate across the Web and embed them in our own documents. We will tell you how in Chapter 12.

    2.13  Forging Ahead

    Clearly, this chapter represents the tip of the iceberg. If you've read this far, hopefully your appetite has been whetted for more. By now you've got a basic understanding of the scope and features of HTML and XHTML; proceed through subsequent chapters to expand your knowledge and learn more about each feature.

     


     

    * Italicized text is a very simple example and one that most browsers, except the text-only variety (e.g., Lynx), can handle. In general, the browser tries to do as it is told, but as we demonstrate in upcoming chapters, browsers vary from computer to computer and from user to user, as do the fonts that are available and selected by the user for viewing HTML documents. Assume that not all are capable of or willing to display your HTML document exactly as it appears on your screen.

    * XHTML documents also begin with the <html> tag, but they contain additional information to differentiate them from common HTML documents. See Chapter 16 for details.

    * We use a computer programming-like style of indentation so that our source HTML/XHTML document are more readable. It’s not obligatory, nor are there any formal style guidelines for source HTML/XHTML
    document text formats. We do, however, highly recommend that you adopt a consistent style so that you and others can easily follow your source documents.

    * With XHTML, <br>’s start and end are between the same brackets: <br />. Browsers tend to be very forgiving and often ignore extraneous things, such as the forward slash in this case, so it’s perfectly OK to get into the habit of adding that end mark.

    † The paragraph end tag is being used more commonly now that the popular browsers support the paragraphalignment attribute.

    * Similar to <br>, with XHTML, the formal horizontal rule end tag is <hr />.

    * The nomenclature here is a bit unfortunate: the “anchor” tag should mark just a destination, not the jumping-
    off point of a hyperlink, too. You “drop anchor”; you don’t jump off one. We won’t even mention the atrociously confusing terminology the W3C uses for the various parts of a hyperlink, except to say that someone got things all “bass-ackward.”

    * Some browsers support other multimedia besides GIF and JPEG graphics for inline display. Internet Explorer, for instance, supports a tag that plays background audio. In addition, the HTML 4 and XHTML standards provide a way to display other types of multimedia inline with document text through a general tag.

    * XHTML is too new to call anyone a veteran or experienced XHTML author.

    * The server-side programming required for processing forms is beyond the scope of this book. We give some basic guidelines in the appropriate chapters, but please consult the server documentation and your server
    administrator for details.

    * Few authors have used the tag, apparently. The <isindex> tag has been “deprecated” in HTML version 4.0—-sent out to pasture, so to speak, but not yet laid to rest.

     


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · This article is an excerpt from the book "HTML & XHTML: The Definitive Guide, Sixth...
     

    Buy this book now. This article is excerpted from chapter two of HTML & XHTML: The Definitive Guide, Sixth Edition, written by Chuck Musciano and Bill Kennedy (O'Reilly; ISBN: 0596527322). Check it out today at your favorite bookstore. Buy this book now.

    HTML ARTICLES

    - Building Single Row Database Forms with HTML
    - Introduction to Database Forms with HTML
    - Another Look at Animation of Geographical Ma...
    - Animation of Geographical Map Regions
    - Changing and Moving Pictures with CSS
    - Clickable Geographical Map Regions
    - Gradient Creation with the HR Element
    - Text on HTML Images: Do it Yourself
    - Custom Buttons in HTML
    - Quick Web Page Menu
    - Maximizing and Restoring HTML Images with th...
    - Maximizing and Restoring HTML Images with th...
    - Handling Hyperlinks and Images in HTML
    - Quick Start with HTML
    - HTML Tips







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway