Hack 40 Formatting the Description with HTML

figs/beginner.giffigs/hack40.gif

Use HTML tags to turn a drab block of text into an interesting, attractive, and effective sales tool.

As a seller on eBay, you're expected to wear a lot of hats: diplomat, market researcher, salesperson, and yes, even web designer. Since eBay auctions are web pages, your description area can be decorated with the same fonts, colors, images, links, and tables found on any other web site.

If you're already familiar with HTML, you'll probably want to skip this primer and just use it as a quick-reference. The rest of the hacks in this chapter contain more meaty HTML code.

4.9.1 Rapid HTML Primer

For many sellers, the introduction to HTML comes in the disappointment of seeing a carefully formatted description seemingly mutilated by eBay. For example, this text:

Antique steam shovel toy:
     real working treads
     working shovel, turn crank to raise
     glossy red lacquer
in immaculate condition!

will look like this when viewed on an eBay auction page:

Antique steam shovel toy: real working treads working shovel, turn crank to raise glossy red lacquer in immaculate condition!

The fault lies not with eBay, but with the way web browsers interpret plain text. All spacing, alignment, and line breaks are effectively ignored in favor of the HTML code that is the basis of formatting in all web pages.

HyperText Markup Language (HTML) consists of plain text interspersed with markup tags. A tag is a special formatting keyword enclosed in pointy brackets (also known as carets and greater-than and less-than symbols). For instance, simply place the <br> tag in your text to insert a line break, or <p> to insert a paragraph break. For example:

real working treads<br>working shovel, turn crank to raise<br>glossy red lacquer

Tags that modify text actually require two parts: a tag to turn the formatting on and another to turn it off. For example, the <center> tag, used to center-justify text and images, requires a corresponding </center> tag later on to restore the default left justification. Other tags that work like this include <b>bold</b>, <i>italics</i>, and the <table></table> structure, all described in the next sections.

4.9.2 HTML Quick Reference

Table 4-2 shows some of the more tags[2] you'll use in your auction descriptions, and how they'll appear on the auction page.

[2] For a complete listing of all HTML tags, consult an HTML reference such as www.w3.org or HTML & XHTML: The Definitive Guide (O'Reilly).

Table 4-2. HTML tags that affect spacing and alignment

Goal

HTML Code

Preview

Line break

First line<br>Second Line

First Line
Second Line

Paragraph break

First line<p>Second Line

First Line

Second Line

No break

My <nobr>red steam shovel</nobr>

My
red steam shovel

Horizontal line, centered

First section<hr>Second section

First section

    ??????

Second section

Center-justify

<center>In the middle</center>

      In the middle

Right-justify

<p align=right>way over</p>

            way over

Indent

<blockquote></blockquote>

See the next table

Start a bulleted list (unordered list)

<ul><li>item A<li>item B</ul>

  • item A

  • item B

Start a numbered list (ordered list)

<ol><li>item A<li>item B</ol>

  1. item A

  2. item B

Display preformatted text with all line breaks and spacing

<pre>Color: Red

Size: Small

Age: Really old</pre>

Color: Red

Size: Small

Age: Really old

Display text in a scrolling marquee

<marquee>Bid Now!</marquee>

w! Bid No

So using some of these tags, we can fully reproduce the steam shovel description as intended:

HTML Code

Preview

Antique steam shovel toy:

<blockquote>real working treads<br>working shovel, turn crank to raise<br>glossy red lacquer</blockquote>

in immaculate condition!

Antique steam shovel toy:

real working treads

working shovel, turn crank to raise

glossy red lacquer

in immaculate condition!

Better yet, let's use bullets:

HTML Code

Preview

Antique steam shovel toy:

<ul><li>real working treads<li>working shovel, turn crank to raise<li>glossy red lacquer</ul>

in immaculate condition!

Antique steam shovel toy:

  • real working treads

  • working shovel, turn crank to raise

  • glossy red lacquer

in immaculate condition!

Note that the individual tags don't have to be on separate lines, but it would sure make the code easier to read. Table 4-3 shows the commonly used HTML tags that affect the appearance of text.

Table 4-3. HTML tags that affect fonts and appearance

Goal

HTML Code

Preview

Bold

Shipping is <b>Free</b>

Shipping is Free

Italics

it's <i>really</i> important

it's really important

Subscript

Drink H<sub>2</sub>O

Drink H2O

Superscript

Turn 180<sup>o</sup>

Turn 180o

Set the font

<font style="font-family:courier">Mono-spaced</font>

Mono-spaced

Set the font size

<font style="font-size:120%">Big</font> or <font style="font-size: 80%">small</font>

Big

or

small

Set the font color

It's <font style="color:white">invisible</font>!

It's !

Tags can be combined to achieve just about any effect. Take care when nesting HTML tags, however, so that structures do not improperly overlap. For example, this is wrong:

The <i>coldest <b>winter</i></b> I ever spent

But this is correct:

was <i>a summer in <b>San Francisco</b></i>

Essentially, tags that are opened first should be closed last.

If you want to test your HTML code before placing it into your auction, simply type it into a plain text editor. Save the file with the .html filename extension and open it in your favorite web browser. Reload/refresh to see changes as they're made.

4.9.3 Images and Links

An image of any size, from a tiny icon to a full-size photo of what you're selling, can be inserted anywhere in your text using the <img> tag, like this:

<img src="http://pics.ebay.com/aw/pics/navbar/ebay_logo_home.gif">

In this case, the image URL points to a GIF file on eBay's pics.ebay.com server that happens to be the eBay logo itself. See [Hack #59] for information on placing your photos on the Web and referencing them from your auctions.

By default, the image will appear inline with the text, which typically doesn't look very professional. Instead, you can left-justify or right-justify the image and the text will wrap around it:

<img src="http://pics.ebay.com/aw/pics/navbar/ebay_logo_home.gif" 
align=right hspace=4 vpsace=7 border=1>

Also shown in this example are the hspace and vspace parameters, which specify invisible horizontal and vertical margins in pixels, and the border parameter, which places a black line around the image with the thickness also specified in pixels.

Hyperlinks are created by placing the <a> (anchor) structure around ordinary text, like this:

<a href="http://www.ebayhacks.com/">click here</a>

Here, the text "click here" will automatically appear blue and underlined in your auction, and when clicked will navigate to the URL http://www.ebayhacks.com/. Make sure to include the closing </a> tag to end the hyperlink.

Always test each and every one of your links before placing them into your auction descriptions. The last thing you want is 20 confused bidders emailing you because you mistyped a URL in one of your links.

Of course, you don't want your bidders to click a link and leave your auction, never to return. To have the link open in a new window, leaving your auction description window intact, include the target="_blank" parameter:

<a href="http://www.ebayhacks.com/" target="_blank">click here</a>

Note that the <img> and <a> tags can be combined to make clickable images; see [Hack #60] for details.

4.9.4 Tables

Tables are easy to create and are a great way to organize information in your auction descriptions. A table is defined with a single <table></table> structure with one or more <tr></tr> and <td></td> structures contained therein. For instance, this code defines a simple table with two rows and two columns:

<table width=90% border=1>
  <tr>
    <td>Color:</td>
    <td>red lacquer with chrome trim</td>
  </tr>
  <tr>
    <td>Dimensions:</td>
    <td>3 inches high, 4 inches long</td>
  </tr>
</table>

Each <tr></tr> structure defines a row in the table, and each <td></td> structure defines a single table cell inside that row. Once a row is complete, another row begins. The resulting table looks like this:

Color:

red lacquer with chrome trim

Dimensions:

3 inches high, 4 inches long

Note that text and images should never be placed outside the <td> tags. Use indents, like in the example above, to make the code more readable and to help you keep track of your rows and columns.

Using nested tables, you can create a nice-looking box to highlight important information:

<table border=0 cellspacing=0 cellpadding=0 width=40% bgcolor=#000000>
  <tr><td>
    <table width=100% border=0 cellspacing=1 cellpadding=3>
      <tr><td bgcolor=#CCCCCC align=center>
        <b>Condition of this item</b>
      </td></tr>
      <tr><td bgcolor=#FFFFFF>
        Brand new in the original box with all original paperwork.
        <br>Batteries are not included.
      </td></tr>
    </table>
  </td></tr>
</table>

which should look something like this:

Condition of this item

Brand new in the original box, with all original paperwork.

Batteries are not included.

The bgcolor parameter in the <td> tag sets the background color; the six-digit code is explained in [Hack #41].

Tables are also often used to make simple bars and stripes. For example, to include section headers that match those on eBay auction pages, use this code:

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td bgcolor="#9999CC">
  <img src="http://pics.ebay.com/aw/pics/x.gif" width=1 height=1>
</td></tr>
<tr><td bgcolor="#EEEEF8" nowrap>
  <img src="http://pics.ebay.com/aw/pics/x.gif" width=6 height=1>
  <font face="Arial" size="3"><b>
    Your Title Goes Here . . . 
  </b></font>
</td></tr>
</table>

Table cells with background colors set with the aforementioned bgcolor parameter can be fine-tuned with transparent, single-pixel images (like x.gif here) used as spacers.

4.9.5 Using a WYSIWYG Editor

For more complicated page layouts, you may wish to use a graphical web page editor such as Netscape/Mozilla Composer (free from www.netscape.com or www.mozilla.org), HTML-Kit (free from www.chami.com/html-kit), or any word processor (Wordperfect, Word, etc.).

The problem is that web page editors are all designed to generate complete HTML pages, not snippets to be inserted into other pages, which means that the generated HTML code must be modified before it's inserted into your auction description. Otherwise, your page may not display correctly and may even interfere with people's ability to bid on your item.

If you've generated a page with a Microsoft Office application such as Word, Excel, or Powerpoint, the resulting HTML will be clogged with extraneous codes that should be removed. The easiest way to do this is to use the Microsoft Office HTML Filter, available for free at www.microsoft.com/downloads.

First, open the generated HTML file in a plain text editor (e.g., Notepad on Windows) so you can see the HTML tags. The actual body of the page will be contained within a <body></body> structure, so all you need to do is delete everything before the opening <body> tag and the closing </body> tag, as well as the tags themselves. Then, select everything that's left (Ctrl-A), copy it to the clipboard (Ctrl-C), and paste it into the description field of the Sell Your Item form at eBay (Ctrl-V).

eBay also provides a WYSIWYG auction description editor as part of the Turbo Lister auction listing tool; see [Hack #73]. But if you want to use the same design for all your auctions, you'll still need to be somewhat familiar with HTML, so you can create clean code that can be used again and again.