How to Remove Spacing Under a Heading


アトラシアン コミュニティをご利用ください。


This page outlines how to alter the spacing under a heading tag.  This is useful for users that want to control the apparent line height of their text after a header.

NOTE: using the shift + enter key board shortcut in this context will not work. Shift + Enter will force a break within a paragraph tag to give the appearance of single line spacing. Under a heading tag it will create a new paragraph tag that is subject to the css spacing rules.

The Fix

This fix alters all of the spacing in all of the pages in your Confluence instance.


Visit Confluence Admin > Custom HTML page.  In this section you will see an area to add custom html to the HEAD section.  Add the following block of text to that area


#main-content h1 {

margin: 0px 0px 0px 0px; 

padding: 0px 0px 0px 0px;}

#main-content p {

margin: 0px 0px 0px 0px; 

padding: 0px 0px 0px 0px;}



This will clear out all of the spacing between the h1 tag and the paragraph tag.  You may add a similar block for any additional heading 1-6.


Fine Tuning

This is a aggressive solution to the problem.  You may wish to add back a bit of spacing to fine tune your display.  To do that we must look at the css box model.



You will note that there are 4 numbers after each margin and padding property. They correspond to the top, right, bottom and left portions of the box model.  If you want to increase the amount of space between paragraphs it is a good idea to alter one of these properties, ideally the botom, with a bit of padding and or margin.

A possible example of this is below

#main-content p {

margin: 0px 0px 5px 0px; 

padding: 0px 0px 0px 0px;}

Selecting a single property to standardize on is a good idea because it reduces confusion later should you need to update this property.

Internet Explorer uses a slightly different box model and will render slightly different that Safari, Chrome and Firefox.


最終更新日: 2016 年 2 月 19 日


Powered by Confluence and Scroll Viewport.