This documentation has moved. For the most recent documentation, check out Please update your bookmarks and links.

Skip to end of metadata
Go to start of metadata


The Div macro wraps content in a div tag with optional class and styles. 

The div tag is a non-visual (by default) element that can be used to apply additional properties to content contained within it.

Unlike the span tag, a div stretches to fill the available width of it's containing element making it ideal for use with blocks of content such as a whole paragraph.

This macro is primarily designed for use with the Style Sheet as this would make it easy to apply custom styles to content. Alternatively you can specify specific styles for each use of the macro.


Click Insert > Other Macros.


Select the Div macro from the provided list.


Complete the desired fields.




Specify a unique id for the element.




ClassThe class to associate with the div. Multiple classes can be specified by separating them with spaces.stringnone


StyleAn optional inline style sheet to apply to an individual div tag.stringnone


TitleText to display in a tooltip.stringnone


Text DirectionSets the text direction.single selectnone


Language CodeSets the language code.stringnone


At least one parameter must be specified

Although not strictly required to insert the macro on to a page, the macro does require one of the parameters above to be specified to function properly.


The macro will then appear on the page.



Custom Class

To define a custom class, use the "class" parameter.

With the Class parameter set to "warningMacro".

This will add the following HTML to the page.

<div class="warningMacro">This is a div example</div>

Resulting in:

This is a div example

In this example, we've hijacked the "warningMacro" class used by the warning macro to put a red border and background on the text contained within the div.


Inline Styles

In our last example, we applied a background and border to some content, but there wasn't any padding between the border and the text. To rectify this we can use an inline style, and make the border a bit bigger.

With the Style parameter set to "padding:3px;border-width:5px".

This will add the following HTML to your page:

<div class="warningMacro" style="padding:3px;border-width:5px">This is a span example</div>

Resulting in:

This is a div example

If you are using the same inline style several times, create a stylesheet for the class using either the Style Sheet or the Builder - CSS Custom Styles feature of the Builder theme.


Frequently Asked Questions:


Where can I learn more about CSS and Div tags?



as they have full tutorials on CSS and HTML.


My nested DIVs aren't displaying properly


Confluence doesn't support nested tags, so the following were created to support nested DIVs:

  • {div2
  • {div3
  • {div4
  • {div5
  • {div6
  • {div7
  • {div8
  • {div9
    They are duplicates of the div macro, and support the same parameters.


My div tag is outputting </div> at the start instead of <div> - why?


You must specify one or more of the parameters (style and/or class) for the macro to work properly.

See Also:


Top of page

  • No labels