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

Can I use a CSS class to style a wiki markup link?

Dee Jul 09, 2012

I'd like to style a wiki markup link inline using a class defined in the global CSS.

What I was expecting to be able to do in wiki markup is something like this:

[link text||class=classname]

If it helps make it clearer, the equivalent HTML for what I'm trying to do would be this:

<a href="" class="classname">link text</a>

Any suggestions?

3 answers

1 accepted

1 vote
Answer accepted

Hallo Dhyana

There are two ways I can think of:

I hope this helps. :)

Cheers, Sarah

Dee Jul 09, 2012

Thanks Sarah, I'm actually using Confluence 4.2 but the link is in a global styling area which is why the wiki markup.

I had thought of using the HTML macro but, upon checking the system plugins in the Confluence Admin console, I saw that the {html} macro has been superceded by {html-xhtml} so I'll give that a go.

Thanks so much.

0 votes
Matthew J. Horn Jul 31, 2012

If you dont want to write a macro, you could also use jQuery. Something like this would add a classname attribute to an <a> tag:


You add this in your Custom HTML panel in the Admin.

If you wanted to only touch specific anchor tags (such as external links), you could do this:


0 votes
Steffen Heller Aug 02, 2012

If you don't mind misusing the link title attribut in a real bad way you could do the following:

Write this into your wiki page:

[link text||green]
[link name||red]

Write this into your CSS export stylesheet

a[title=green] {
a[title=red] {

The result on the html page will be this:

&lt;a href="" title="green"&gt;link text&lt;/a&gt;
&lt;a href="" title="red"&gt;link text&lt;/a&gt;

and the apperarence of the links in the PDF file will be according to the formats in the CSS export stylesheet.

The result will be the same as with a class but off course it is against the real intention of the title attribut.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Confluence

6 Awesome Ways to Apply Trello, JIRA and Confluence to your Project

I attended  Atlassian Summit 2019  and learned a lot from the presenters, attendees and knowledgeable Atlassian product managers. The presentations I attended focused on applying Agile, pla...

1,481 views 8 19
Read article

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