It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How do you add an background image to a confluence page

I have been trying to add an image as a background to a Confluence page using HTML but am struggling to get it to work.

I can change the colour of the area behind the Confluence page but not the Confluence page itself.

Can anyone advise?

1 answer

3 votes

Hi Sarah, 

You can achieve this by creating a user macro. However, you'll need admin access to do this.

Here's some sample code that should help:

## @param image:title=Background Image URL|type=string|required=true|desc=A link to the image to display in the background.
<div style="background-image: url($paramimage)">$body</div>

When creating the macro, you'll need to set the 'Macro body processing' mode to 'Rendered':

Screen Shot 2018-10-04 at 3.58.26 pm.pngThis macro will accept any content in it and display with a background image of your choice behind it.

You can find some additional documentation for writing a user macro here:

https://confluence.atlassian.com/doc/user-macro-template-syntax-223906130.html

Let me know if you've got any further questions!

This is great and extremely helpful. I've been looking for this solution for a long time and finally, this works. The only adjustment I would like to make is to not have the BG image repeat when the page is zoomed out. Is this possible?  

Like Sarah likes this
Sarah Atlassian Team Aug 29, 2019

Hi Lavesh, 

Yes, this should be relatively straightforward to do. 

Simply add an additional CSS property to the macro definition:

## @param image:title=Background Image URL|type=string|required=true|desc=A link to the image to display in the background.
<div style="background-image: url($paramimage);background-size: cover;">$body</div>

You can alternatively use a `background-repeat: no-repeat;` property.

Hope this works for you!

Like Lavesh_Budhrani likes this

This works perfectly! Thanks Sarah

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

How is your team having fun and bonding, remotely, utilizing Confluence?

Thanks everyone for answering last week’s question. The winner of the random drawing from those who commented is: @LarryBrock I’ll contact you separately with your prize details. This wee...

294 views 9 7
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you