Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Creating custom titles using CSS

Avinash August 8, 2012

Hi,

I am trying to assign different font, color and style only to my title of the page. (I also do NOT want to assign the title as h1,h2...h6). I have used the followng css style for the title.

p.heading{

color: #2D637F;

font-family: ="Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", "Lucida Sans", Arial, sans-serif;

font-size: 24px;

font-weight:bold;

line-height: 1.5em;}

Now the tilte content is say "Welcome". How do i use wiki mark up to assign the above css code to only this particular heading without using html macro?

plz help...Thanks!

3 answers

1 accepted

1 vote
Answer accepted
Steffen Heller
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.
August 8, 2012

Hi Avinash,

you must make sure that the html and the css matches.

The wiki code

{div:class=heading}

My Title

{div}

creates the html code

<div class="heading">
<p>My Title</p>
</div>

So you have .heading p in html but p.heading in CSS. Change one of them to match the other and it will work.

Steffen

Avinash August 8, 2012

Thank you so much! Works like a charm! :)

1 vote
Amalia
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.
August 8, 2012

You can create a custom user macro. Go to Confluence Admin > User Macros > Create a User Macro. Type "title" as Macro Name and Macro Title, and select "Rendered" for Macro Body. For template, add the following:

## @param dummy:title=dummy|type=string

<p class="heading">$body</p>

The parameter I put there is dummy since user macro requires you to put a parameter in order to include it in the Macro Browser.

Add a new page, click Insert Macro and search for "title". Add the title macro into the editor and type the title in the body of the macro.

Don't forget to put the CSS code that you mentioned above into the Stylesheet page in the Confluence Admin.

1 vote
CharlesH
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.
August 8, 2012
You could use the span or div macros available from the Adaptavist advanced formatting plugin I believe. Those macros allow you to specify inline style attributes or a class.
Avinash August 8, 2012

I tried using div macro in the wiki markup this way

{div:class=heading}

My Title

{div}

But nothing happens. Its like i cant make it identify my heading in the markup. :(

CharlesH
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.
August 8, 2012

I think Steffen may have given you a pointer to make this work. See his answer below.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events