Forums

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

How can I put a style into a user macro ?

Florent R_ April 16, 2021

Hello,

 

I want to make a user macro that write numbered headings in the page where it is placed. I tried to do that but the style is overwritten by the global stylesheet. Do you have an idea to help me ?

 

#content.page.view {
/* Set "title1" to 0 */
counter-reset: title1;
}

#content.page.view h1 {
/* Set "title2" to 0 */
counter-reset: title2;
}
#content.page.view h1:before {
/* Increment "title1" by 1 */
counter-increment: title1;
content: counter(title1) ". ";
}

#content.page.view h2 {
/* Set "title3" to 0 */
counter-reset: title3;
}
#content.page.view h2:before {
/* Increment "title2" by 1 */
counter-increment: title2;
content: counter(title1) "." counter(title2) ". ";
}

#content.page.view h3 {
/* Set "title4" to 0 */
counter-reset: title4;
}
#content.page.view h3:before {
/* Increment "title3" by 1 */
counter-increment: title3;
content: counter(title1) "." counter(title2) "." counter(title3) ". ";
}

#content.page.view h4 {
/* Set "title5" to 0 */
counter-reset: title5;
}
#content.page.view h4:before {
/* Increment "title4" by 1 */
counter-increment: title4;
content: counter(title1) "." counter(title2) "." counter(title3) "." counter(title4) ". ";
}

#content.page.view h5 {
/* Set "title6" to 0 */
counter-reset: title6;
}
#content.page.view h5:before {
/* Increment "title5" by 1 */
counter-increment: title5;
content: counter(title1) "." counter(title2) "." counter(title3) "." counter(title4) "." counter(title5) ". ";
}

#content.page.view h6:before {
/* Increment "title6" by 1 */
counter-increment: title6;
content: counter(title1) "." counter(title2) "." counter(title3) "." counter(title4) "." counter(title5) "." counter(title6) ". ";
}

2 answers

1 vote
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 Leaders.
September 21, 2021

The trick here is to wrap the content of your macro in a classed div tag, then adjust your CSS rules accordningly.

<div class="myclass">
$body
</div>
1 vote
Brant Schroeder
Community Champion
September 20, 2021

@Florent R_ 

You should be able to do it if you use some additional hierarchy in the CSS.  

Thanks
Brant

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events