#### 32.5.1 Aligning anchored graphics

When you use CSS, you can center graphics with DITA2Go macros. For example, to center all images:

    [GraphStartMacros]
    * = <div class="img">

    [GraphEndMacros]
    * = </div>

See §32.4.2 Replacing or surrounding a graphic with macro code.

Include in CSS:

    div.img {text-align: center; }

Or, if DITA2Go maintains CSS for your project (see §31.8.3 Overriding styles in DITA2Go-generated CSS files):

    [CSSEndMacro]
    div.img {text-align: center; }

You have to use <div> because CSS applies text-align only to block elements, and <img> is not a block element.

Previous Topic: 32.5 Positioning graphics in HTML output

Next Topic: 32.5.2 Indenting images (deprecated)

Parent Topic: 32.5 Positioning graphics in HTML output

Sibling Topics:

32.5.2 Indenting images (deprecated)

32.5.3 Adding space above an image

32.5.4 Eliminating space above or below graphics in table cells

Table of Contents • Index