Web daugava.com
HTML tips
  • Here is how you can make table have a small black border around it:
    <table style="border-width:1px; border-style:solid; border-color:black;"> <tr> <td> Table contents
    </td> </tr> </table> This is how it looks:

    Table contents

    It works in IE, Opera 6 and Netscape 6.2 (not Netscape 4).

  • The 'copyright symbol' can be inserted with &#169

  • Inserting &nbsp; between words is prevents the line from wrapping there.

  • In a SELECT box, when OPTION VALUE is not specified, the value will be the same as label.

  • When stylesheet is in effect, you can still use the font size - just use absolute size
    instead of relative (size=2, not size=-1).

  • When you specify ALIGN in TR, it will override default behavior of inner tags - for
    example if you do TR ALIGN=LEFT, the TH tags inside the TR will also be left aligned.

  • Cross-browser way to create list with graphical bullets:
    <dl> <dt><dd><img src="bullet_red.gif"> First item
    <dt><dd><img src="bullet_red.gif"> Second item
    <dt><dd><img src="bullet_red.gif"> Third item
    <dt><dd><img src="bullet_red.gif"> Fourth item
    </dl>

  • To create unordered list without bullets, use <ul type=none> (This only works in Netscape, for IE you will need to use <STYLE>)

  • When shrinking image, some quality is lost, but this is less noticeable if color of the image
    is closer to the background color of the page.

  • Code to get page to expire immediately, so it's not cached:
    <META HTTP-EQUIV="EXPIRES" CONTENT="0">

  • When form has default values, Reset button doesn't clear them - rather it undoes all
    the changes that user made in the form.

  • Using <ul> without <li> can be used to insert a 'tab'.

  • Interesting way to do "make this site your homepage" - link leads to .reg file,
    which contains
    REGEDIT4

    [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]
    "Start Page" = "http://www.URL.com

  • Turning off the underline for links:
    <style type="text/css"> <!--
    a{text-decoration:none}
    //--> </style> To do change the color of the link when mouse is over it, use something like
    a:hover{color:yellow; }

  • BODY settings:
    hlink - color of link that you just clicked, while the page is still on screen
    alink - 'active link' - then one where text hilite is

  • You can rig an image to trigger event when it's clicked:
    <img src="iskull1.gif" onclick="alert('Do not click here, dammit!')"> Try it: click on skull.

    This works in IE, but not in Opera/Netscape.

  • Here's a way to stretch table to entire page width, while keeping cell contents
    compact:
    <table bgcolor=#FFFF99 width=100%> <tr> <td width=10%> Subject: </td> <td width=90%> Test message</td></tr> </table> It will look like this:
    Subject: Test message

  • Javascript/forms - the language is case-sensitive (grrr), so
    the major cause of 'has no properties' error is specifying
    something like FORM NAME=XX instead of FORM NAME="xx".

  • Disassembling HTML forms

  • Unordered list (<ul>)seems to align long paragraphs
    better than ordered one (<ol>).

  • Making images larger than their actual size may add fresh look,
    like here.

  • Using <TH> can work for centering image in table cell,
    just as well as <TD ALIGN=CENTER>, but with less typing.

  • Things like <TD WIDTH=40%> do not work unless
    WIDTH is also specified in <TABLE>. Why ? The answer,
    my fiend, is blowing in the wind.

    Also, widths within TD are still relative to the screen, not
    to the table.

  • Some special chars:
    &#133 -
    &#134 -
    &#135 -
    &#149 -
    &#151 -
    &#167 - §
    &#168 - ¨
    &#182 -
    &#185 - ¹

  • This is how CNET does colored bullets:
    <font size="+1" color="#009933"><b>&#149</b></font>

  • Specifying several fonts in FONT FACE - extra ones are
    substitute choices, in the case the 1st font is not available
    on user's system.

  • InfoSpace has a bunch of servers and you can try several -
    for example, if http://in-119.infospace.com/info/business.htm
    is not responding, try http://in-118.infospace.com/info/business.htm.

  • Linking to the root page:
    <a href="/">

  • How to force specific encoding from a page
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1251">

  • To display image in the same line as form, put img src
    inside of <form> block.

  • When HTML document has a <title>, it will show up as file
    comment in directory that has no index file in it.

  • Entire page with <i> doesn't look bad at all - for example,
    this one.

  • When page contains single HTML form, pressing ENTER will
    work the same as SUBMIT button - you can even omit SUBMIT button
    altogether.

  • <li> tag will put a bullet on screen even if it is not part of
    <ul> construction.

  • Selection box - pressing same key repeatedly wil advance you in
    list of matching entries.

  • When 'hidden' is misspelled in HTML form, 'text' is assumed.

  • Inserting ascii char into HTML - & #160

  • You can scale down the image in img src HTML tag:
    <img src="jawa.gif" height=60 width=100>

  • Trick - just as you can do TD ALIGN=CENTER,
    you can do TH ALIGN=LEFT to get boldface text without
    centering.

  • There is tag for underline: <U>.

  • There is option BORDERCOLOR in HTML table - can do both for table
    itself and single rows.
    They look good on screen, but not in print.
    And Netscape doesn't support them.

  • You can specify row color in HTML table:
    <TD BGCOLOR="#4A94EF"> (good looking cyan/blue).

  • IE 3.0 requires <HTML> tag - kju!

  • HTML numbered list: <ol>