Libreoffice Writer: format headings like the web's "inline-block" behaviour

cn flag

(Ubuntu 20.04, Libreoffice version (An answer for a newer version is also welcome.)

I would like to format a series of headings in a document (all are h2 level).

For the sake of efficiency, I would like to use the "Styles" feature, wherein I can edit the visual rules for all headings in a single place, and where administered changes will update all instances of headings at once.

(The "Styles" sidebar can be opened with the F11 shortcut key. The corresponding dialog windows are also accessible through right clicking any heading, then from the appearing context menu, hovering "Paragraph", then from the flyout menu, chosing "Edit styles".)

I wish to use a background color and a border for the headings; normally, these features will show up in the full width of the page, from left page margin to right page margin, even if the heading's text constitutes only a single word. (This is comparable to the web's "block" layout behaviour.)

I however wish that my background-colors and borders apply only immediately around the text nodes, in a "stretch" fashion. (This is comparable to the web's "inline", or "inline-block" behaviour.)

I have found two (unsatisfactory) workarounds:

  • one can update the right indent of each heading manually, and adjust its width to match the text nodes inside
  • one can select the text nodes, and apply "Character"-level formatting to them, where a proper background feature is not, but at least the border feature is available.

Both of these workarounds have the following drawbacks:

  • they need to be carried out manually for each instance, which is not desirable,
  • both of these methods inadvertently "freeze" / override some styling features, and thus, such formatted texts will not be receptive to subsequent modifications through the collective "Styles" feature.

Is there a trick that would enable what I am after, but solely through the "Styles" feature?

ec flag
Not sure why this LibreOffice question is getting asked here. Stackoverflow ( would likely generate better solutions.
24601 avatar
in flag
or [ask libre office](
I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.