The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Include CSS in confluence user macro

Michael Schlueter (secunet)
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 Champions.
August 24, 2018

I have written an user macro in Confluence. The macro contains a modified css style

<style type="text/css">form.aui legend, form.aui .field-group>label, form.aui .field-group>aui-label {float: none !important; width: auto !important;} </style>

 

If a page with this macro is rendered in the browser 

the  .field-group>label is replaced by .field-group&gt;label an therefore the style is not applied to the page. If I change the &gt; back to > in the page source code everything is fine. Is there are to prevent this from happening?

 

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Maree Milne
October 1, 2018

Hi Michael

I am having the same problem, did you find a resolution for this?

Cheers

Maree

Michael Schlueter (secunet)
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 Champions.
October 1, 2018

Hi Maree,

unfortunately, we were not able to find a resolution for this.

Regards

Michael

Like Claudia Sander likes this
0 votes
Bill Bailey
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 Champions.
August 27, 2018

Might help to post your macro code to get a better picture.

Generally, I don't like including CSS style inside a user macro because if you have multiple occurrences on a page, the page loads a duplicate style sheet for each macro.

A better approach is to just add your desired style to the Space CSS. This approach makes it easier to catch conflicts and debug issues.

Michael Schlueter (secunet)
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 Champions.
August 29, 2018

Actually, the user macro does not contain anything else but the CSS. The reason is that we use the EasyForm macro on some pages. The default style of that macro is pretty ugly and we want to change the CSS to make it nicer.

I could do this in the space CSS, but I'm afraid that it will have bad side effects on other pages/macros, too.

Bill Bailey
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 Champions.
August 29, 2018

Understand. Usually these macro also have some special/unique classes to help prevent styling walking over each other.

The safest way to move forward is to either set up a test space, or a development server and just test it out.

Like Claudia Sander likes this
TAGS
AUG Leaders

Atlassian Community Events