Re: Spacer

by KeithWBell(at)aol.com

 Date:  Fri, 28 Apr 2000 10:03:37 EDT
 To:  beno(at)cnw.com,
hwg-techniques(at)mail.hwg.org
  todo: View Thread, Original
In a message dated 28/04/00 14:43:32 GMT Daylight Time, beno(at)cnw.com writes:

> My O'Reilly HTML *Definitive Guide* book tells me that if I insert
>  <spacer type=horizontal size=50>
>  in front of a paragraph block that I will have a nice 50 pixel space: like 
>  a tab indent. Well, it just plain doesn't work.

Not really surprising, Ben: <spacer> isn't part of the HTML specification, 
and I don't think it ever has been. Might work in some browsers, though - 
I've seen it in lots of people's code.

> What does?

Couple of possibilities. First, using CSS, there is the 'text-indent' 
property. To quote from the CSS2 spec:

------------------
'text-indent' 
Value:   <length> | <percentage> | inherit  
Initial:   0  
Applies to:   block-level elements  
Inherited:   yes  
Percentages:   refer to width of containing block  
Media:   visual  

This property specifies the indentation of the first line of text in a block. 
More precisely, it specifies the indentation of the first box that flows into 
the block's first line box. The box is indented with respect to the left (or 
right, for right-to-left layout) edge of the line box. User agents should 
render this indentation as blank space. 

Values have the following meanings:

<length> 
The indentation is a fixed length. 
<percentage> 
The indentation is a percentage of the containing block width. 
The value of 'text-indent' may be negative, but there may be 
implementation-specific limits. 

Example(s):

The following example causes a '3em' text indent. 

  P { text-indent: 3em }
------------------

Problem at the moment is the limited support in browsers for this property. 
Another way is simply to add a few non-breaking spaces before the first word 
in each new paragraph, e.g.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Here is the first line...

Or another more complicated way is to put a transparent gif of sufficient 
width before the text:

[Unable to display image]Here is the first line...

HTH

Keith Bell

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA