Controlling the Text-Alignment

In Confluence, you can right, left, center align or justify text. If you want to use multiple alignments for text or pictures that are part of a paragraph, you have to use an User-Macro. The User-Macro tells the exporter which content to align different from the style set in the exporters template.

If you dont know how to write user macros, please see: Background: Writing User Macros.


This is just a workaround, unless EXP-476 is fixed.

To create the user macro:

  1. Click the cog icon at top right of the screen and select Confluence Admin.
    The Administration Console is displayed.
  2. In the Configuration section, click User Macros.
    The screen User Macros is displayed.
  3. Click Create a User Macro.
  4. Enter a Macro Name.
  5. Activate the option Visible to all users in the Macro Browser.
  6. Enter a Macro Title.
  7. (Optional) enter a Description.
  8. Select Confluence Content in the drop-down Categories.
  9. (Optional) enter an Icon URL.
  10. Enter the URL of this page in the field Documentation URL.
  11. Activate the option MacroBody Processing Rendered.
  12. Depending on the macro alignment, replace the code in the field Template with the following code:

    Right Alignment

    ## @noparams 
    <p class="scroll-right-aligned" style="text-align: right">$body</p> 

    Center Alignment

    ## @noparams 
    <p class="scroll-center-aligned" style="text-align: center">$body</p> 


    ## @noparams 
    <p class="scroll-justified" style="text-align: justify">$body</p> 
  13. Click Save.
    The macro is now saved and must be defined in the template.

To define the macro in the template:

  1. Open your template and click Content Formatting.
  2. Depending on the macro alignment, enter the following code at the end of the CSS:

    Right Alignment

    p.scroll-right-aligned { 
    text-align: right; 

    Center Alignment

    p.scroll-center-aligned { 
    text-align: center; 


    p.scroll-justified { 
    text-align: justify; 
  3. Click Save.
    The macro is defined in the template and the content will be exported in the wanted alignment.
  4. To use the macro, enter  '{macro-name' and enter the content.

    Please make sure to insert every content paragraph in a seperate macro. If you have multiple paragraphs in the same macro-body, the alignment is not rendered correctly.

Cookie Notice

We use cookies to create a secure and effective browsing experience for our website visitors and to understand how you use our site (i.e. Google Analytics). For more information:
Click Here

OK Don't track me.