#### 32.5.2 Indenting images (deprecated)

Best practice is to use CSS to indent images in HTML. The technique described in this section should be used only if you cannot use CSS.

Note: This technique has been superseded by format configuration properties, which use CSS; see §7. Configuring output formats.

DITA2Go can indent all non-inline graphics in HTML output using a technique invented by Chuck Musciano

http://www.drdobbs.com/184411862

This technique consists of placing, at the start of the line that contains the graphic, a one-pixel transparent GIF image, 1p.gif, with a width attribute that produces the required indent in pixels. See §37.2.2 Modifying DITA2Go-supplied macro definitions.

To use the built-in DITA2Go spacer graphic:

    [HTMLOptions]
    ; UseSpacers = No (default)
    ; or Yes, use to position tables and graphics
    UseSpacers = Yes

To use your own graphic as a spacer instead of the built-in graphic:

    [HTMLOptions]
    ; WriteSpacerFile = No (default) or Yes, write file after conversion
    WriteSpacerFile = Yes

When WriteSpacerFile=Yes, the default name of the indent spacer image file is 1p.gif; you can specify a different name, or specify a different path:

    [HTMLOptions]
    ; PixelSpacerImage = name of 1-pixel transparent GIF for spacing
    PixelSpacerImage = 1p.gif

By default, DITA2Go writes the spacer image file to the project directory, and includes references of the following form in your HTML output:

    <img src="1p.gif" . . . >

If you supply a path for PixelSpacerImage (for example, ./graphics/1p.gif), DITA2Go writes the spacer image file to the specified path. Then DITA2Go generates references of the form:

    <img src="./graphics/1p.gif" . . . >

This can be important if you place graphics anywhere but the project directory (see §32.1 Locating graphics files for HTML).

Spacer alt attribute

The spacer graphic must have an alt attribute for W3C validation. The default value for the spacer alt attribute is [spacer]; you can change this default:

    [HTMLOptions]
    ; SpacerAlt = text to use for alt attribute for spacer,
    ;  default [spacer]
    SpacerAlt = [spacer]

Left indent

You can specify a custom indent for a single graphic or a graphics group; for example:

    [GraphIndents]
    ; Graphic ID = number of pixels to indent using PixelSpacerImage
    ;  zero prevents indent, -1 is autoindent (default action)
    schematic = 30

See §32.4.1 Assigning properties to sets of graphics.

Right indent

A similar method creates a space to the right of the image, except that the height attribute of the spacer is set to match the height attribute of the image. This is useful for run-in graphics, and for other floating types. For example:

    [GraphRightSpacers]
    ; Graphic ID = number of pixels space on right using PixelSpacerImage
    ch00b5d3 = 45

No indent

If you do not want any graphics indented, use a wildcard setting, as follows:

    [GraphIndents]
    * = 0

See §3.6 Using wildcards in configuration settings.

Previous Topic: 32.5.1 Aligning anchored graphics

Next Topic: 32.5.3 Adding space above an image

Parent Topic: 32.5 Positioning graphics in HTML output

Sibling Topics:

32.5.1 Aligning anchored graphics

32.5.3 Adding space above an image

32.5.4 Eliminating space above or below graphics in table cells

Table of Contents • Index