Using content boxes in MadCap Flare: Tips and tricks
In Part One, you learned how to create content boxes for HTML5 and PDF outputs in Flare. In Part Two, we’ll explain some strategies for using content boxes efficiently in MadCap Flare.
Adding a content box
There are a few different ways to add a content box to the topic you’re working on. To use these methods, create a topic in your project that contains copies of all the styles you use in your document, including the content boxes. You can call this document template.htm or something similar.
Copying the code
- Go to template.htm.
- Copy the entire div of the content box you want to use. You can do this by clicking the div selector on the left side of the XML editor and pressing Ctrl+C.

- Paste it to the page you’re working on, and modify the content.
Using a snippet
- Go to template.htm.
- Hover over the div of the box you want to use. Right-click and select Create Snippet.
- In the Create Snippet window:
- Give your snippet a relevant name and put it in the appropriate folder.
- Uncheck Replace Source Content with the New Snippet.
- Click Create.

- In the topic you’re working on, go to Insert > Snippet in the top ribbon. Choose the snippet of the content box you want to use and click OK.
- If you need to add more content boxes of the same type elsewhere, you can pin the content box snippet in the Insert Snippet Link window by hovering over the snippet’s line and clicking the thumbtack icon that appears.

- If you need to add more content boxes of the same type elsewhere, you can pin the content box snippet in the Insert Snippet Link window by hovering over the snippet’s line and clicking the thumbtack icon that appears.
- Right-click the div and select Convert to text.

- Modify the content in the box.
Putting new content in a box
One way of putting new content in a box is to add the content to the Flare topic before wrapping it in a div. This is a good strategy for boxes where the icon’s line height overlaps with the line height of a single line of text, which makes it difficult to select in the XML editor.
To do so:
- Paste the content box you need using one of the methods described above.
- In a paragraph tag under the content box, add the content that you want to put in the box. Add any elements that you need, such as conditions, cross-references, and variables, in this step.
- Delete the existing text in the content box.
- On the left side of the editor, right-click the paragraph selector that your new content is in and click Move > Move Up.
- Change the paragraph style of text and images to p.ContentBox.
- Repeat steps 4 and 5 for the rest of your content. If the p.ContentBox style uses negative top padding, use the p.ContentBox2 style as needed.

Editing inside the box
If you need to edit an existing content box, here are some ways to do that:
- Click the div you want to edit. Then, change tabs to the Text Editor and edit the content there. The code of the div you clicked will already be highlighted. Make your edits in the Text Editor.

- To edit text, click inside the content box, press the down arrow on your keyboard, and then press the right arrow. This will put you on the correct line so you can edit text. To select text, hold down the Shift key while pressing the arrow key in the direction you want to select.
Well-formed content boxes can help you break your documentation into small chunks and highlight important information. With this article series, you’ll be able to create easy-to-use content boxes for your Flare projects.
