CLOUD16

 
 

        
What is HTML anyway? Find out here!
The Basics of HTML
HTML Tags Reference Section
Character Formatting
Color
Multimedia
Frames
Tables
Style Sheets
Image Maps
Forms
Scripts
Objects
Client Pull
Frequently Asked Questions
Click here to send mail to Helpquarters
 
  1. What is everyone using to write HTML? 
  2. Where can I find a list of all the current HTML tags?<= /a> 
  3. How can I include comments in HTML? 
  4. How can I check for errors? 
  5. How do I let people download a file from my page? 
  6. I tried to link to a [_______] but it only downloaded = a bunch of characters instead!? 
  7. Where can I get a "hit counter"? 
  8. Where can I put my newly created web Pages? 
  9. Where can I announce my site? 
  10. How do I use forms? 
  11. How can I strip all the HTML from a document? 
  12. How do I indent the first line in my paragraphs? 
  13. How do I indent a lot of text? 
  14. Can I put markup in ALT text? 
  15. How do I include one file in another? 
  16. How do I get scrolling text in the status bar? 
  17. How do I hide my source? 
  18. How can I make a custom rule, or a list with custom b= ullets? 
  19. How do I display the current date or time in my docum= ent? 
  20. For what screen size should I write? 
  21. How do I get my visitors' email addresses? 
  22. How do I do a page break? 
  23. How do I make a table which looks good on non-support= ing browsers? 
  24. How do I center a table? 
  25. How do I make animated GIFs? 
  26. Is there a way to get indexed better by the search en= gines? 
  27. How do I redirect someone to my new page? 
  28. How do I get a back button on my page? 
  29. How do I force a download? 
  30. How do I use an image instead of the standard submit = button? 
  31. How do I get a so-and-so character in my HTML? 
  32. How do I detect what browser is being used? 
  33. I want to get an audio file to play automatically whe= n someone visits my site! 
  34. Should I put quotes around attribute values? 
  35. Should I use lower case or upper case for tags? 
  36. My images/hyperlinks are coming out all wrong, or don't load! What's up? 
  37. How do I get a button which takes me to a new page? 
  38. How do I right align text or images? 
  39. Should I end my URLs with a slash? 
  40. Can I have two or more Submit buttons in the same for= m? 
  41. Which should I use, &entityname; or &#number;= ? 
  42. How can I allow file uploads to my web site? 
  43. How can I update two frames at once? How can I preven= t getting framed? 
  44. How do I include a subject in a mailto: link? 
  45. Why does my page display fine in browser X but incorr= ectly or not at all in browser Y? 
  46. Why does my link work in Internet Explorer but not in= Netscape? 
  47. How do I turn off underlining on my links? 
  48. I'm getting a colored whisker to the left or right of= my image... 
  49. Can I nest tables within tables? 
  50. How do I make a form so it can be submitted by hittin= g ENTER? 

1. What is everyone using to write HTML?

It seems that everyone has a different preference for which tool works= best for them. You may find lists of HTML authoring tools at:   Keep in mind that typically the less HTML the tool requires you to kno= w, the worse the output of the HTML. In other words, you can always do it b= etter by hand if you take the time to learn a little HTML.  

2. Where can I find a list of all the current HTML tags= ?

The current W3C recommendation is HTML 3.2, code-named Wilbur. Wilbur documents the constructs that were already in mainstream use as of= early 1996. As a result, authors using the HTML 3.2 codeset can be assured tha= t their documents will be accessible to most readers. Other extensions may be us= ed, but careful consideration needs to be given to the consequences of display on unsupporting browsers.  

Recommended materials on HTML 3.2:  

Some materials on browser-specific versions of HTML:  

3. How can I include comments in HTML?

A comment declaration starts with "<!", followed by zero or more comments, followed by ">". A comment starts and ends with "--", and does not contain any occurrence of "--" between the beginning and ending pairs. This means that the following are all legal HTML comments:<= /p>  
  • <!-- Hello --> 
  • <!-- Hello -- -- Hello--> 
  • <!----> 
  • <!------ Hello --> 
  • <!> 
But some browsers do not support the full syntax, so we recommend you follow this simple rule to compose valid and accepted comments:  
An HTML comment begins with "<!--", ends with "-->" and does not contain "--" or ">" anywhere in the comment. 
See <URL:http://www.htmlhelp.com/reference/wilbur/misc/comment.html> for a more complete discussion. 

4. How can I check for errors?

The easiest way to catch errors in your HTML is through the use of a program called a validator. A validator is a program which knows all the rules in HTML, reads your source document and outputs a list of mistakes.=  

While checking for errors in the HTML, it is also a good idea to check for hypertext links which are no longer valid. There are several link checkers available for various platforms which will follow all links on a site and return a list of the ones which are non-functioning. 

You may find a list of validators and link checkers at <URL:http://w= ww.htmlhelp.com/links/validators.htm>. 

The Unofficial WebTechs HTML Validator FAQ at <URL:http://www.cs.duk= e.edu/~dsb/wt-faq/> gives lots of tips on using the WebTechs validator. That site also offers a list of validators, including programs like Weblint and HTMLchek that warn you about practices that are legal but may still give fits to browsers or readers. 

5. How do I let people download a file from my page?

Once the file is uploaded to the server, you need only use an anchor reference tag to link to it. An example would be:  
    <a href=3D"../files/foo.zip">Download Foo Now! (100kb)</a>=
;
It is possible that the server might need to be configured for some diffe= rent file types. (See the next Q&A.)  

6. I tried to link to a _______ but it only downloaded = a bunch of characters instead!?

If you are trying to link to a particular type of file and it is not returning your desired response, chances are that the server needs to have the type configured. Talk to your system administrator about getting them to add the content type. Here is a list of common types that often need configuring: 
    Content Type                    Description
    application/msword              Microsoft Word Document
    application/octet-stream        Unclassified binary data (often used =
for
                                    compressed file or executable)
    application/pdf                 Adobe Acrobat Document
    application/wordperfect6.0      WordPerfect 6.0 Document
    application/zip                 Zipped binary file
    audio/x-wav                     .wav audio format
    image/gif                       .gif image format
    image/jpeg                      .jpg or .jpeg image format
    image/png                       .png image format
    text/html                       .html or .htm document
    text/plain                      Plain ASCII text
    video/mpeg                      MPEG video format
    video/quicktime                 Mac video format
    video/x-msvideo                 AVI video format
Another method of insuring that your file is properly sent to the client = is to compress it into a standard compression format. Virtually all servers= are set to handle the standard .gz and .zip extensions and they are widely recognized by users. More information may be found at:   Some servers (NCSA, Apache, and others) can be configured to support user-configured content types. Details are server dependent, so consult your server admin or documentation. 

7. Where can I get a "hit counter"?

A hit counter is a small script or program that increases a number every time a document is accessed from the server.  

Why do you want one? If you believe that it will tell you how many times your documents have been accessed, you are mistaken. No counter can keep track of accesses from browser caches or proxy caches. Some counters depend on image-loading to increment; such counters ignore accesses from text-mode browsers, or browsers with image-loading off, or from users who interrupted the transfer. Some counters even require access to a remote site, which may be down or overloaded, causing a delay in displaying your documents. 

Most web servers log accesses to documents stored on the server machine. These logs may be processed to gain information about the *relative* number of accesses over an extended period. There is no reason to display this number to your viewers, since they have no reference point to relate this number to. Not all service providers allow access to server logs, but many have scripts that will output information about accesses to a given user's documents. Consult your sysadmin or service provider for details. 

Counter services and information are available from Yahoo's list of co= unters: http://www.yahoo.com/Computers/World_Wide_Web/Program= ming/Access_Counts/ 

Log analysis tools and scripts are at http://www.yahoo.co= m/Business_and_Economy/Companies/Computers/Software/Internet/World_Wide_W= eb/Log_Analysis_Tools/ 
<URL:http://www.ca-p= robate.com/counter.htm> is another good source for counter information.  

8. Where can I put my newly created web Pages?

  1. Many ISPs offer web space to their dial-up customers. Typically this = will be less than 5mb, and there may be other restrictions; for example, many = do not allow commercial use of this space. 
  2. There are several companies and individuals who offer free web space.= This usually ranges from 100kb up to 1mb, and again there are often limitation= s on its use. They may also require a link to their home page from your pages.= The following page has pointers to several lists of free web space providers: <URL:http://www.yahoo.com/Busine= ss_and_Economy/Companies/Internet_Services/Web_Services/Free_Web_Pages/>. 
  3. There are also many web space providers (aka presence providers) who = will sell you space on their servers. Prices will range from as little as $1 p= er month, up to $100 per month or more, depending upon your needs. Non-virtu= al web space is typically the cheapest, offering a URL like: http://www.some-provider.com/yourname/ For a little more, plus the cost of registering a domain name with InterN= IC (<URL:http://rs.internic.net/&= gt;), you can get virtual web space, which will allow you to have a URL like http://www.yourname.com/. 
  4. If you have some permanent connection to the Internet, perhaps via le= ased line from your ISP then you could install an httpd and operate your own w= eb server. There are several web servers available for almost all platforms. 
  5. If you just wish to share information with other local users, or peop= le on a LAN or WAN, you could just place your html files on the LAN for everyon= e to access, or alternatively if your LAN supports TCP/IP then install a web s= erver on your computer. 

9. Where can I announce my site?

10. How do I use forms?

Information relating to the use of forms is available at <URL:http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Do= cs/fill-out-forms/overview.html> and also at <URL:http://= www.hut.fi/~jkorpela/HTML3.2/5.25.html>.  

11. How can I strip all the HTML from a document?<= /H2> 

One of the easiest ways is to open a document in a graphical browser such as Internet Explorer or Netscape, select all the text and copy it to the clipboard. Most browsers also have a "save as" function which will allow you to save the file as plain text. 

Lynx users can use "lynx -dump http://..." on the command line to print to file and append a list of referenced URLs as footnotes. If you want the output file without the footnotes, use the "p" command to "print" to a text file. 

Some HTML authoring tools have an option to strip all HTML as well. T= wo programs of note are  

If you are looking for another method (in other words you want to make things more difficult on yourself), you can obtain programs which will strip away all HTML markup from a document. Try doing a search at <URL:http:/= /www.altavista.digital.com/cgi-bin/query> for the phrase "html stripper". 

12. How do I indent the first line in my paragraphs?

Style sheets are the only method of reliably doing this. However, the= y are not yet widely supported. At this moment, there are several browser-specific kludges and tricks available, but these are not guarante= ed to work. The only trick that doesn't seem to hurt anything is to include= a number of "&nbsp;" (&#160;) characters. Netscape and related browsers do not collapse these, like normal spaces, so this appears as an indent in these browsers. Other browsers can display it as one space.  

Some older versions of browsers (e.g., Netscape 1 and Mosaic 2) display the &nbsp characters rather than the spaces, and this could affect rendering of the document. 

13. How do I indent a lot of text?

Again, style sheets are the answer for indenting purposes. However as was previously stated, they are not yet widely supported. If you are willing to use tables for layout purposes, there is another option. Create a one-cell table, as follows:  
    <CENTER>
    <TABLE width=3D"80%">
    <TR><TD>
    <DIV align=3Dleft>
    <!-- The text goes here -->
    </DIV>
    </TD></TR>
    </TABLE>
    </CENTER>
A drawback to this solution is that very long blocks inside a table ma= y take a while to download and may not appear until the entire table has be= en downloaded. Another drawback is that it may force users to resize their viewing window after they have become accustomed to their preferred settings. And of course, the author must take into consideration how th= e contents will display on browsers that do not support tables.  

14. Can I put markup in ALT text?

No. Character entities (&copy;, &#nnn; and such) are permitted= , though.  

If you want to know how to write good ALT texts without markup, please see Alan Flavell's essay on choosing ALT texts at <URL:http://ppewww.ph.gla.ac.uk/%7Eflavell/alt/alt-text.html>. 

15. How do I include one file in another?

Use server-side includes, if your server supports them. Ask your webma= ster if this is the case, and if so, what the exact syntax is for your server.=  

Since server-side includes make the document slower, they are not always desirable. If your documents only have a static footer, which doesn't change every day, you might be better off using an editor which can insert files in the current document, or a preprocessor. The C preprocessor can do this, but there are also several HTML-specific preprocessors available. 

16. How do I get scrolling text in the status bar?= 

This is not an HTML question, it's done with JavaScript. Check any page which has this feature, and copy the script from the source.  

This script has two big problems. One, usually it uses the decrement operator (c--) at some point. The "--" sequence in a comment actually closes it on some browsers, so your code may "leak" on those browsers. The same goes for ">".  

Second, keep in mind that many people consider this even worse than <BLINK>, and that it also suppresses the status information which normally appears there. It prevents people from knowing where a link goes to. 

17. How do I hide my source?

You can't. The source is necessary for the browser to display your document. You have to send the complete, unencrypted source to the browser. Even if a particular browser doesn't have a "View source" option, there are many that do, and you can always retrieve the document by hand (using telnet) to get its source. Or check the browser's cache. 

You can of course put a few hundred empty lines above the actual sourc= e, then newbies who don't see the scrollbars will think there is nothing there. <= /p>  

18. How can I make a custom rule, or a list with custo= m bullets?

There was a proposal in the now-expired HTML 3 draft to handle exactly this: just add SRC to the <HR> or <UL> tag, indicating where the image can be found. But HTML 3 was never implemented. Style sheets should offer a better solution, but they are not yet widely supported. Until they are, about all you can do is kludge with an <IMG> tag.  

For a custom rule, use an <IMG> tag with a line of "--" characters = as ALT text. 

For custom bullets, there are several methods, none completely satisfactory:  

  • Use a <DL> with <DD> tags with preceding images (with ALIGN and suitable ALT text) and no <DT>; this won't be as beautiful as a "real" list. 
  • Use a two-column table, with the bullets in the left column and the text in the right. But this won't work well on browsers that don't support tables. 
  • Create the bullet with the indent built in. For example, if you use a bullet that is 10 pixels across you can make the background 25 pixels (transparent) and put the bullet all the way on the right. This will create a 15-pixel indent to the left of the bullet. It will add slightly to the byte size of the graphic but since it is all one color it won't add much. This method doesn't work well with any list items that are longer than a line (and remember that you don't know how long a line will be on the visitor's screen). 

19. How do I display the current date or time in my do= cument?

With server-side includes. Ask your webmaster if this is supported, and what the exact syntax is for your server. But this will display the local time on the server, not for the client. And if the document is cached, the date will of course be incorrect after some time. JavaScript can be used to display the local time for the client, but agai= n, as most people already have one or more clocks on their screen, why displ= ay another one?  

If you plan on putting the current date or time on your pages, using a CGI-, Java- or VBscript, take an extra breath and consider that it will take resources, add time to the loading of the page, and prevent good caching. If you find that you really have a need to use it, for instance to inform readers of the up-times of an FTP server, then by all means do so. If, on the other hand, your only reason is 'it looks cool!' - then reconsider.  

20. For what screen size should I write?

HTML does not depend on screen size. The text will be wrapped by the browser when the end of the window is encountered. The only exception to this is when you use <PRE>-formatted text, which will only wrap at the line breaks you indicate. So make sure these lines are no longer than 70 characters, otherwise text mode users will see ugly line breaks on their terminals. And users of graphical browsers might have to scroll horizontally to see the rest, which is one of the most hated things to do when you read a document.  

Of course, an image cannot be wrapped, so you have to be careful with that. It seems that 400 or 500 pixels is a reasonable width; anything above 600 will mean a certain percentage of users will have to scroll to see the rightmost bit. This percentage increases with your image width. Keep in mind that not everyone runs his browser at full screen! 

(WebTV users have no ability to scroll horizontally, so anything beyond 544 pixels will be lost to them or compressed by their browser. Some other devices may be even more limited.) 

21. How do I get my visitors' email addresses? 

You can't. Although each request for a document is usually logged with the name or address of the remote host, the actual username is almost never logged as well. This is mostly because of performance reasons, as it would require that the server uses the ident protocol to see who is on the other end. This takes time. And if a cache proxy is doing the request, you don't get anything sensible. 

But just stop to think for a minute... would you really want every single site you visit to know your email address? Imagine the loads of automated thank you's you would be receiving. If you visited 20 sites, you would ge= t at least 20 emails that day, plus no doubt they would send you invitation= s to return later. It would be a nightmare as well as an invasion of privac= y! 

In Netscape 2.0, it was possible to automatically submit a form with a ma= ilto as action, using JavaScript. This would send email to the document's owner, with the address the visitor configured in the From line. Of cours= e, that can be "mickey.mouse@disney.com". This was fixed by Netscape 2.01.  

The most reliable way is to put up a form, asking the visitor to fill in his email address. To increase the chances that visitors will actually do it, offer them something useful in return. 

22. How do I do a page break?

You don't. HTML is not a page layout language. It's up to the browser to decide where and how to insert page breaks when the document is being printed. 

However, style sheets (not widely supported yet, although Microsoft's Internet Explorer and Netscape Communicator partially implement them) wil= l include support to indicate preferred points for page breaks, probably somewhat like the way LaTeX handles this. 

23. How do I make a table which looks good on non-supp= orting browsers?

The best way is probably to include a version in preformatted text. This can be seen by any browser, including Lynx. 

If you absolutely must have a table, check out Alan Flavell's document on tables for a good discussion at <URL:h= ttp://ppewww.ph.gla.ac.uk/%7Eflavell/tablejob.html>. 

24. How do I center a table?

The "correct" way of doing it is <TABLE ALIGN=3DCENTER>, but this doesn't work in several popular browsers. Put <CENTER> around the entire table for these browsers. 

This causes some problems with browsers that do support CENTER but not tables, such as Lynx. In these browsers, the contents of the cells are now displayed centered, which is not what is intended. To avoid this, you can put the cell's contents in <P ALIGN=3Dleft> or <DIV ALIGN=3Dleft> depending on the amount of text in the cell. 

25. How do I make animated GIFs?

There are some things to be aware of with the use of animated GIFs. Fi= rst not all browsers support them. Browsers that lack support for this type o= f GIF will simply display one frame of the multiple frames within. This means that the image must be carefully constructed to work with non-supporting browsers as well. Also keep in mind that those non-support= ing browsers must still download the entire GIF to display it. 

Secondly, the use of animated GIFs causes all but the latest releases = of browsers to constantly flash messages in the status bar. This has become = a big complaint for many web users as the flashing status bar interferes wi= th being able to preview where a hyperlink will lead to. 

Finally, if after considering all these factors it's animated GIFs you= 're after, check out these resources: 

26. Is there a way to get indexed better by the search= engines?

Yes. Use a meaningful <TITLE> and headings (<H1>, <H2>, and so on). The indexing programs of some search engines (including AltaVista and Infoseek) will also take into account the following tags in the <HEAD> part of your documents: 

<META NAME=3D"keywords" CONTENT=3D"keyword keyword keyword keyword">= ;  
<META NAME=3D"description" CONTENT=3D"description of your site">  

Both may contain up to 1022 characters, but no markup other than entities. If you use a keyword too often in the <META NAME=3D"keywords"> tag,= the indexing program may ignore your keywords list altogether. At this writin= g, "too often" means "more than 7 times" to some popular engines, but that m= ay change in the future as indexing programs are changed to defend against "cheaters". 

Search Engine Watch at <URL:http://searchenginewatc= h.com/> is a web site dedicated to search engines and strategies for web page authors. 

27. How do I redirect someone to my new page?

The most reliable way is to configure the server to send out a redirection instruction when the old URL is requested. Then the browser will automatically get the new URL. This is the fastest and most efficient way, and is the only way described here that can convince indexing robots to phase out the old URL. For configuration details consult your server admin or documentation (with NCSA or Apache servers, use a Redirect statement in .htaccess). 

If you can't set up a redirect, there are other possibilities. These are inferior because they tell the search engines that there's still a page at the old location, not that the page has moved to a new location. But if it's impossible for you to configure redirection at your server, here are two alternatives:  

  • Put up a small page with text like "This page has moved to http://new.url/ -- please adjust your bookmarks." 
  • A Netscape and MSIE solution, which doesn't work on many other browse= rs (and screws up the "back" button in Netscape) is: 

  • <META HTTP-EQUIV=3D"Refresh" CONTENT=3D"x; URL=3Dnew.URL">  
    which will load the new URL after x seconds. This should go in the HEAD of the document. But if you do this, also include a short text saying "Document moved to new URL so-and-so" for other browsers. (The screwing-up bit refers to the fact that if you press "Back" after you have been redirected, you will be taken to the document with the META refresh. Then the refresh will be activated, and so you'll jump to the page you just tried to leave.) 

28. How do I get a back button on my page?

In HTML, this is impossible. Going "back" means that you go to the previous page in your history. You might be able to create a link to the URL specified in the "HTTP_REFERER" environment variable in your document, but that only creates a link to a new location in your history. Even worse, the information in that variable can be plain wrong. Some browsers incorrectly send the variable when you use a bookmark or type in an URL manually, and some don't send that variable at all. This would result in an empty link. 

A JavaScript could use "history.back()" to do this, but this only works in Netscape 2 or higher and MSIE 3 or higher, and even then only if the user has not disabled JavaScript. 

For a more detailed explanation, please see Abigail's "Simulating the back button" at <URL:http://www.ny.fnx.com/abigail/HTML/Misc/back_button.html>. 

29. How do I force a download?

You can't, because the web doesn't work that way.  

Here's the explanation. When someone downloads a document, the server tells the browser what type of file it is. The browser then displays it or picks the appropriate helper applicat= ion. If the server doesn't know the file type, it tells the browser that the file is "text/plain", or just plain text (true for most servers). You may need to ask your server admin to configure this particular file with the MIME type you want.  

"Forcing" a download is not what you are supposed to do. After all, what is more convenient than having the proper application started when I download a particular file? Browsing through a download directory can be quite a pain. And most browsers allow the user to download to disk if they want to.  

If the file must be saved to disk, if there is absolutely NO other way to handle it, the MIME type should be "application/octet-stream". 

30. How do I use an image instead of the standard subm= it button?

Use <INPUT NAME=3Dfoo TYPE=3Dimage SRC=3D"http://url.to/image.gif"> instead of the normal submit tag. There is no way to do this for the reset button.  

Most browsers will also send the x and y coordinates of the location where the user clicked on the image to the server. They are available as "foo.x=3D000&foo.y=3D000" in the CGI input.  

31. How do I get a so-and-so character in my HTML?= 

The safest way to do HTML is in (7-bit) US ASCII, and expressing characters from the upper half of the 8-bit code by using HTML entities. See "Which should I use, &entityname; or &#number; ?" below. 

Working with 8-bit characters can also be successful in many practical situations: unix/X and MS-Windows (using Latin-1), and also Macs (with some reservations). 

The available characters are those in ISO-8859-1, listed in the HTML2.= 0 specification and at <URL:http://www= .htmlhelp.com/reference/charset/>. On the WWW, use only the characters from this list. In particular, characters 128 through 159 as used in MS-Windows are not p= art of the ISO-8859-1 code set and will not be displayed as Windows users expect. This includes the em dash, en dash, curly quotes, bullet, and TM symbol; neither the actual character nor &#nnn; is correct. (See the last paragraph of this answer for more about those characters.) 

On platforms whose own character code isn't ISO-8859-1, such as MS DOS= , Macs, there may be problems: you'd have to use text transfer methods that convert between the platform's own code and ISO-8859-1 (e.g Fetch for the Mac), or convert separately (e.g GNU recode). Using 7-bit ASCII with entities avoids those problems, and this FAQ is too small to cover other possibilities in detail. Mac users - see the notes at the above URL. 

Some communities work together in other than Latin-1 codes, but such documents fall outside current HTML standards, and won't be generally accessible to other WWW readers. Yet. 

If you run a web server (httpd) on a platform whose own character code isn't ISO-8859-1, such as a Mac, or IBM mainframe, it's the job of the server to convert text documents into ISO-8859-1 code when sending them to the network. 

If you want to experiment with characters outside of the ISO-8859-1 repertoire, see RFC 2070 at <URL:= http://www.cis.ohio-state.edu/htbin/rfc/rfc2070.html> and the Babel site at <URL:http://babel.alis.com:808= 0/>. But be aware that many WWW readers will be unable to view your documents properly yet. 

32. How do I detect what browser is being used? 

Many browsers identify themselves when they request a document. A CGI script will have this information available in the HTTP_USER_AGENT environment variable, and it can use that to send out a version of the document which is optimized for that browser. 

Keep in mind not all browsers identify themselves correctly. Microsoft Internet Explorer, for example, claims to be "Mozilla" to get at Netscape enhanced documents. 

And of course, if a cache proxy keeps the Netscape enhanced document, someone with another browser will also get this document if he goes through the cache.  

For these reasons and others, it is not a good idea to play the browser guessing game. 

33. I want to get an audio file to play automatically = when someone visits my site!

Most browsers support the EMBED element for this, provided that the user has a suitable plug-in for the sound file. You can reach a sligh= tly wider audience if you use BGSOUND as well. To avoid problems with browsers that support both, place the BGSOUND in a NOEMBED container: 

<EMBED SRC=3D"your_sound_file" HIDDEN=3Dtrue AUTOSTART=3Dtrue= > 
<NOEMBED><BGSOUND SRC=3D"your_sound_file"></NOEMBED> 

For more on the EMBED element, see <URL:http://www.netscape.com/comprod/products/navigator/version_3.0/multimedi= a/audio/how.html>. See <URL:http://www.microsoft.com/msdn/sdk/inetsdk= /help/dhtml/references/html/BGSOUND.htm> for more information on B= GSOUND. Note that these elements are proprietary and not in any HTML stan= dard. (The HTML standard way of doing this is not well supported.) 

Be aware that some users find it annoying for music to automatically start playing. They may not have the volume set properly on their speaker= s, or they may be listening to something else. As a courtesy to your users, you may prefer to offer the sound file as a link: 

<A HREF=3D"your_sound_file">Listen to my sound! (5 kB MIDI)&l= t;/A> 

34. Should I put quotes around attribute values? 

It depends. It is never wrong to use them, but you don't have to if the attribute value consists only of letters, digits, periods and hyphens. This is explained in the HTML 2.0 specs.  

Be careful when your attribute value includes double quotes, for instance when you want ALT text like "the "King of Comedy" takes a bow" for an image. Humans can parse that to know where the quoted material ends, but browsers can't. You have to code the attribute value specially so that the first interior quote doesn't terminate the value prematurely. There are two main techniques:  

  • Escape any quotes inside the value with &#34; so you don't terminate the value prematurely: ALT=3D"the &#34;King of Comedy&#34; takes a bow". (&quot; is not part of the formal HTML 3.2 spec, though most current browsers still support it.) 
  • Use single quotes to enclose the attribute value: ALT=3D'the "King of Comedy" takes a bow'. 
Both these methods are correct according to the spec and are supported by current browsers, but both were poorly supported in some earlier browsers. The only truly safe advice is to rewrite the text so that the attribute value need not contain quotes, or to change the interior double quotes to single quotes, like this: ALT=3D"the 'king of Comedy' takes a bow". 

35. Should I use lower case or upper case for tags?

Tags are case insensitive, so it doesn't matter. This is just a matter of style. (You may have noticed that this FAQ is no= t absolutely consistent in capitalization.) Many people prefer upper case, as it makes the tags "stand out" better amongst the text.  

Attribute names can also be upper or lower case, as you prefer. But some attribute values are case sensitive. For example, <OL TYPE=3DA> and <OL type=3DA> are the same, but <OL TYPE=3Da>= ; is different from both of them. (For clearer communication, it's worth getting the terminology right. In this example, OL is the element, TYPE is the attribute name, and A and a are the attribute values. The tag is <OL TYPE=3DA>.) 

Entity names like &nbsp; are sometimes incorrectly referred to as tags. They are all case sensitive. &Eacute; &eacute; are two different and valid entities; &NBSP; is invalid. 

36. My images/hyperlinks are coming out all wrong, or = don't load! What's up?

Most likely you forgot to close a quote at the end of an HREF or SRC. Alternatively, perhaps you used a ">" character in an ALT text or somewhere else inside a tag. Although this is legal, several older browsers will think the tag ends there, so the rest is displayed as normal text.  

This especially happens if you use comment tags to "comment out" text with HTML tags. (See "How can I include comments in HTML?" above.) Although the correct syntax is <!-- --> (without "--" occurring anywhere inside the comment), some browsers will think the comment ends at the first > they see.  

Validators will show you any syntax errors in your markup, but checkers such as Weblint and HTMLchek can show you where you are liable to provoke known browser bugs. See "How can I check for errors?" above. 

37. How do I get a button which takes me to a new page= ?

This is best done with a small form:  

<FORM ACTION=3D"http://url.you.want.to.go.to/" METHOD=3DGET>  
<INPUT TYPE=3Dsubmit VALUE=3D"Text on button" NAME=3Dfoo>  
</FORM> 

If you want to line up buttons next to each other, you will have to pu= t them in a one-row table, with each button in a separate cell. 

(A go-to-other-page button can also be coded in JavaScript, but the above is standard HTML and works for everyone.) 

38. How do I right align text or images?

You can use the ALIGN=3Dright attribute on paragraphs, divisions, and headers, just as you use ALIGN=3Dcenter to create centered paragraphs and such. This will right align your text (ragged left). 

Perhaps what you really want is justified text, in which the left and right edges are both aligned so that all lines are the same length. (This is sometimes incorrectly called "right justify".) There's no way to justify text in HTML 3.2, but it can be done in a CSS1 style sheet with "text-align: justify". (Before you do that, a caveat: though justified text may look pretty, human factors analysis shows that ragged right is actually easier to read and understand.) 

For images, you can use <IMG ALIGN=3Dright SRC=3D"..." ALT=3D"...">= before the running text. The image will float at the right margin, and the running text will flow around it. Remember to use <BR CLEAR=3Dright> or <BR CLEAR=3Dall> to mark the end of the text that is to be affected in this way. 

39. Should I end my URLs with a slash?

The trailing slash is used to distinguish between directory and file URLs. A file URL is an URL for a file, and a directory URL refers to a directory. For example, the URL for the WDG's HTML reference is http://www.htmlhelp.com/reference/ and the URL for the overview of HTML 3.2 elements is http://www.htmlhelp.com/reference/wilbur/overview.html  

If you request a directory URL without the trailing slash, the browser will actually ask for a FILE with that name. This file doesn't exist on the server, so the server sends back a message saying that the browser should ask for the directory. It uses a redirection message for this. The browser then sends another request, this time for the directory, and finally gets what was asked for in the first place. This wastes time and network resources. 

When you write a document, all directory URLs should end with a slash. Since you already know you are linking to a directory, why force the user to make that second request, when it could have been done using only one? 

And by the way, it is NOT the browser which appends the slash. The browser cannot know if what you are asking for is a file or directory, not even when the final part of the URL does not have an extension. http://www.somewhere.com/src/something/README is a perfectly valid URL, has no extension in the final part, yet refers to a file and not a directory. 

The only apparent exception is when you refer to an URL with just a ho= stname. Since it is obvious that when you use http://www.htmlhelp.com you actually want the main index "/" from our server, you do not have to include the / in this case. It is regarded as good style to do so, however. 

For a full discussion of the proper form of URLs, see RFC 1738 at <URL:= http://www.cis.ohio-state.edu/htbin/rfc/rfc1738.html> and, for relative URLs, RFC 1808 at <URL:= http://www.cis.ohio-state.edu/htbin/rfc/rfc1808.html>. 

40. Can I have two or more Submit buttons in the same = form?

Sure. This is part of HTML2.0 Forms support (some early browsers did not support it, but browser coverage is now excellent). 

You will need to give your Submit buttons a Name attribute, and, optionally, a Value attribute. In order to determine which button was used, you will want to use distinctive Names, or Values, or both. Browsers will display the Value, in addition to sending it to the server, so choose something that's meaningful to the user.  

Example: 
<INPUT TYPE=3DSUBMIT NAME=3Djoin VALUE=3D"I want to join now">= ; -or- 
<INPUT TYPE=3DSUBMIT NAME=3Dinfo VALUE=3D"Please send full details">= ;  

If you're unsure what results you're going to get when you submit your form, NCSA has a standard script which you can use. Code this, for example (assuming method "post"):  
<form method=3D"post" action=3D"http://hoohoo.ncsa.uiuc.edu/htbi= n-post/post-query">  

and then go through the motions of submitting your form. The NCSA server decodes the form input, and displays the result to you. 

41. Which should I use, &entityname; or &#numb= er; ?

All current browsers support both, but some older browsers have only limited coverage of the names. We recommend: 
  • For the Latin-1 accented letters, also lt, gt, amp, and quot when needed, use the names. They are easily remembered, and browser coverage is excellent. 
  • &copy; and &reg; and &nbsp; are now covered by most browsers. You still might want to use their #number representations (&#169; &#174; &#160;) to allow for older browsers. 
  • For the remainder, the #number representation is still marginally preferable. Entity names were listed in the HTML 2.0 spec and are honored by HTML 3.2-compliant browsers, but there are still browser versions in u= se that don't honor them. 

42. How can I allow file uploads to my web site? 

First of all, the RFC for this is located at <URL:http= ://www.ics.uci.edu/pub/ietf/html/rfc1867.txt>. 

File upload is handled by the CGI.pm Perl5 library available from <URL:http://www-genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.htm= l>. 

It should be noted that these methods have just begun to appear and as such are untested. It may be possible for someone to cause damage to a system, for example by uploading a virus to the server. Additionally, because of the nature of the web, the culprit would be virtually untraceable. 

These things are necessary for web-based uploads:  

  • An http server that accepts uploads. 
  • Access to the /cgi-bin/ to put the receiving script. 
  • A form implemented something like this: 
  •     <form method=3D'POST' enctype=3D'multipart/form-data' action=3D'fu=
    p.cgi'>
        File to upload: <input type=3Dfile name=3Dupfile><br>
        Notes about the file: <input type=3Dtext name=3Dnote><br>
        <input type=3Dsubmit value=3DPress> to upload the file!
        </form>
Netscape gives a [browse] button, MSIE does not.  

43. How can I update two frames at once?
How can I = prevent getting framed?

These and other questions about frames are answered in the WDG Frames FAQ at <URL:http://www= .htmlhelp.com/design/frames/faq/>. 

44. How do I include a subject in a mailto: link?<= /H2> 

You can't, not in any reliable way. The methods that are frequently poste= d don't do the job on all browsers (or even all popular browsers), and many of them have an important drawback: if your visitors are using a certain popular browser, their mail will be lost, with no warning to them or to you. 

If you really need a subject, you can do it by providing a form on your page, which submits data to a CGI program that emails the form data to you with your desired subject line. However, the form must have an input field for the visitor's email address, and you must hope that the visitor enters it correctly. 

Here are some other ways to transmit subject-type information:  

  • Create email aliases that are used only for certain mailto links, so you'll know that anything sent to a given alias is in response to the corresponding web page(s). 
  • The mail handlers for many web browsers include an "X-Url" header tha= t specifies the URL of the web page that contained the mailto link. If you configure your mail reader to display this header, you'll see which web page the sender is responding to much of the time. 
  • Use <A HREF=3D"mailto:user@site" TITLE=3D"Your Subject">. MSIE, NN, and some other browsers will ignore the TITLE attribute (which is valid HTML, but characterized in the spec as "an advisory title for the linked resource"), but will still send the mail. 
  • Use <A HREF=3D"mailto:user@site(Your Subject)">, which puts your subject in the "To" header field of the email message. This is a valid email address, but some minor browsers don't handle it properly and you'll never receive the email from their users. 
  • Don't use <A HREF=3D"mailto:user@site?subject=3DYour Subject">, which puts your subject in the "Subject" header field of the email message if the user has a recent release of NN or Lynx. This is an invalid email address, and you'll never receive the email from users of older versions or other browsers. 

45. Why does my page display fine in browser X but inc= orrectly or not at all in browser Y?

There are several possibilities. 

First, you may have some incorrect HTML. Browsers vary in their ability to guess what you meant. For instance, Netscape is much more fussy about tables than MS Internet Explorer, so a page with incorrect tables may look fine in MSIE but not display at all in Netscape. See "How can I check for errors?" above for tips on finding your HTML errors. (In fact, even correct nested tables may not display correctly in Netscape. See "Can I nest tables within tables?" below for what you can do about that.) 

Second, you may have valid HTML that different browsers interpret differently. For instance, it is not clear from the spec what should be done with a string of &nbsp; characters. Some browsers will collapse them for rendering as a single space; others will render one space per &nbsp;. 

Other possibilities are a bug in one or the other browser, or different user option settings. 

See also "My images/hyperlinks are coming out all wrong, or don't load!" above. 

46. Why does my link work in Internet Explorer but not= in Netscape?

Is there a space, #, ?, or other special character in the path or filename? Spaces are not legal in URLs. If you encode the space by replacing it with %20, your link will work. 

You can encode any character in a URL as % plus the two-digit hex value of the character. (Hex digits A-F can be in upper or lower case.) According to the spec, only alphanumerics and the special characters $-_.,+!*'() need not be encoded. 

You should encode all other characters when they occur in a URL, except when they're used for their reserved purposes. For example, the # character is used to delimit an http URL from a fragment/anchor identifier. When used for that purpose, it must be written "#"; when used for any other purpose (for instance, in the path part of the URL), it must be written "%23". 

See section 2.2 of RFC 1738 at <URL:http://www.w= 3.org/Addressing/rfc1738.txt> for the full story. 

47. How do I turn off underlining on my links? 

If you want to turn off link underlining when you're looking at pages in your browser, check your browser's configuration options. In Netscape 3, for example, see Options | General Preferences | Appearance; in Netscape 4 it's Edit | Preferences | Appearance | Colors; in Internet Explorer see View | Options | General. 

  

If you want to prevent links on your page being underlined when your visitors see them, there's no way in HTML to accomplish this. You can do it using style sheets (if the visitors' browsers support style sheets) by defining  

    a:link, a:visited, a:active {text-decoration: none}
which indicates that text inside <A HREF=3D...></A> tags should be displayed without underlining or anything else. If your page has no <A NAME=3D...> tags, you can simplify that style to  
    a {text-decoration: none}
which indicates that text inside *any* <A...></A> tags should not be underlined. 

But before you do this, ask yourself whether you really want to. Underlining is a valuable hint to visitors that there is an available link. Why make things more difficult for them?  

48. I'm getting a colored whisker to the left or right= of my image...

This is the result of including "white space" (spaces and newlines) before or after an IMG inside an anchor. For example:  
    <A HREF=3D...>
    <IMG SRC=3D...>
    </A>
will have white space to the left and right of the image. Since many browsers display anchors with colored underscores by default, they will show the spaces to the left and right of the image with colored underscores. 

Solution: don't leave any white space between the anchor tags and the IMG tag. If the line gets too long, break it inside the tag rather than outside it, like this:  

    <A HREF=3D...><IMG
    SRC=3D...></A>
Style checkers such as Weblint will call attention to this problem in your HTML source. 

49. Can I nest tables within tables?

Yes, a table can be embedded inside a cell in another table. Here's a simple example, with borders turned on so you can see where the tables are: 
    <table>
    <tr>
        <td>this is the first cell of the outer table</td>
        <td>this is the second cell of the outer table,
            with the inner table embedded in it<br>
        <table>
            <tr>
            <td>this is the first cell of the inner table</td>=
;
            <td>this is the second cell of the inner table</td&g=
t;
            </tr>
        </table>
        </td>
    </tr>
    </table>
The main caveat about nested tables is that Netscape has problems with them if you don't close your TD and TR tags meticulously. You're best advised to include every </TD> and </TR>, even though the HTML spec doesn't require them; otherwise Netscape users may not be able to view your page. 

50. How do I make a form so it can be submitted by hit= ting ENTER?

The short answer is that the form should just have one <INPUT TYPE=3DTEXT> and no TEXTAREA, though it can have other form elements like checkboxes and radio buttons. For a more detailed answer, s= ee <URL:http://ppewww.ph.gla.ac.uk/%7Eflavell/www/formquestion.html> 

 
 
  Back to Top

Search the Internet with MetaCrawler
anyallphrase

sqCLOUD18 sqCLOUD2