Editing CSSs in Confluence OnDemand

Bill October 21, 2012

If you are using Confluence OnDemand, can you edit the CSSs for online topics or for exported PDF documents? In the user guide, the topic "Styling Confluence with CSS" gives me the impression that you cannot.

7 answers

1 accepted

7 votes
Answer accepted
Pascal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 24, 2012

Well, actually I was about to settle with the "no css styling in OnDemand" restriction, until I found a really good workaround, by making use of the "{style}" macro.

Go to Space Admin > Themes and select "Configure theme" for your current theme. In the header text you can now use the "{style}" macro like so:

{style}
  .wiki-content h1 { 
    border-bottom: 1px solid #98bddd !important; 
  }
  a.blogHeading {
    font-size: 14pt !important;
  }
  .blog-post-listing .wiki-content {
    color: #637687 !important;
  }
{style}

Works like a charm in our OnDemand instance and I hope Atlassian keeps this option open for us who want to customize the look and feel of our spaces.

Bill October 24, 2012

I've never used the {style} macro, but it seems to apply to only one page. This doesn't sound practical for a whole document.

Pascal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 24, 2012

Wisherut, if you look at the description of the header text of a theme you'll see that it says: "Display a banner or text at the top of every page in this space by entering wiki markup here.". And that's exactly how it works. Hence, all CSS rules specified here are all applied to all pages within the space. Copy and paste my example and see for yourself.

Miguel Piedrahita August 31, 2015

Very helpful, thanks Pascal

Zaqir Virani November 24, 2015

They should include this in their proper documentation, it's very handy.

calv81 February 29, 2016

Thank you so much!!!!!

I even love the css codes that you provided as an example smile

Miguel Piedrahita June 14, 2016

Hmm, apparently the Documentation Theme has been discontinued in OnDemand.  The default theme does not appear to allow you to "Configure theme", so I'm not seeing a way to apply Pascal's workaround.  Does anybody have a solution for this?

1 vote
John Tolle October 28, 2016

The Style macro no longer works for OnDemand (a.k.a. Cloud) Confluence in the Admin Theme Header/Sidebar/Footer/etc. areas.

Entering a style block in the Header...

{style}
  .myCSSclass {
    color: #ff0000;
  }
{style}

Will cause the following to appear in the source code:

Unknown macro: { color}

Fortunately, entering good old CSS in the Style macro still works just fine on a standard page.  The macro works a bit differently (which is good!) in that the contents of the macro are the CSS styles themselves, rather than content to be displayed.  It is also possible to point the macro at an external CSS file using the Import attribute of the Style macro.

.myCSSclass {
  color: red;
  font-weight: bold;
  /* etc. */ 
}

P.S. While editing the style, the tab key does what you want it to do!

When done creating/editing styles, apply them to the contents of Div macros, using the class attribute.

This is cumbersome to apply across multiple pages, but at least custom styles are still possible.

Gino Marckx August 30, 2017

Yes, this macro allows you to style certain things on a page in Confluence Cloud . However, it seems to cause the entire page to be rendered in an iframe, which in turn causes the entire page to be surrounded with whitespace that does not belong there.

Any solutions to that?

0 votes
kristofferb October 11, 2015

To add to what Pascal Lindelauf said, this can also be done globally in Confluence Cloud. Go to Confluence administration → [Look and Feel] Sidebar, header and footer.

I found the pre and code tags not to be distinctive enough, so I added this:

{style} code, pre { background-color: rgb(238,238,238) ; } {style}
0 votes
Jason Ota April 4, 2013

Fantastic. Thanks for clarifying this. I can resize fonts.

{style}

.wiki-content p {

font-size: 12px;

}

{style}

0 votes
Pascal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 3, 2013

@Jason, sorry... I forgot to mention that theme configuration is not available for every theme. We primarily use the Documentation Theme and it's available for that in "Space Admin > Themes" under the descriptive text of the Documentation Theme.

0 votes
Jason Ota April 3, 2013

Where is this option? For OnDemand Confluence 5.0, I can see Confluence Admin -> Themes, but there is no option for "Configure theme". Cheers.

This is an essential feature that I would love to have. Being unable to adjust the font size and padding is a massive weakness in the OnDemand offering.

0 votes
JohnA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 22, 2012

Hi Wisherut,

I'm sorry to say that styling Confluence OnDemand with CSS is classified as one of the restricted functions for the OnDemand platform, so this isn't permitted as per our policy on the restricted functions on the OnDemand platform: https://confluence.atlassian.com/display/AOD/Restricted+Functions+in+Atlassian+OnDemand

Therefore, if you require to stylise your Confluence instance or customise your .PDF export templates then youy will need to migrate to a self-hosted instance of Confluence.

All the best,
John

Bill October 23, 2012

Does that apply PDF output, too? I've been trying unsuccessfully to experiment with customizing PDF output. For example, I wanted to use the HTML code in one of your examples to create a customized title page. Some of your instructions directed me to identify the location of an image that I wanted to put on the title page, but when I right-clicked on the image to get the location, the location was not available.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events