How to overwrite a style definition?

I'm trying to add a space style definition for something which is defined in an atlassian stylesheet.

How can I do it?

e.g. the style sheet "splitter.css" (part of the documentation theme) has


body, p, td, table, tr, .bodytext, .stepfield, .wiki-content p, .panelContent{
color: #333;
background:none;
}

The "background:none" is causing me some trouble. I found how to create a space style to set background to any other color, but I cannot make this definition uneffective (like "unset" in Linux shell) .

3 answers

1 accepted

I copied the page and stylesheet to my PC and opened it locally. Modified the stylesheet to no longer enforce the background to "none". In this way I got the row highlighting to work correctly.

Though, this is not a soluation, because I do not want to create my own theme for this purpose, nor do I want to modify the Atlassian provided theme.

So I reported this as a bug.

0 vote
David Simpson Community Champion Jan 04, 2012

You need to be more aggressive with your CSS selectors.

So this should overide things:

body#com-atlassian-confluence, 
#com-atlassian-confluence p, 
#com-atlassian-confluence td, 
#com-atlassian-confluence table, 
#com-atlassian-confluence tr, 
#com-atlassian-confluence .bodytext, 
#com-atlassian-confluence .stepfield, 
#com-atlassian-confluence .wiki-content p, 
#com-atlassian-confluence .panelContent {
    color: #000;
    background: hotpink; 
}

Thanks, David for our quick answer. Actually, I'm able to set any valid color (even without being "more agressive"), but I cannot remove the effect of the existing "background:none" style definition in splitter.css. There are certain macros (e.g. table-plus from famous Bob Swift) which dynamically set "bgcolor" on tr, but the stylesheet's definition of "background:none" has precendence over html and javascript. Setting background to any color (including "none") turns other attempts to set the bgcolor off. I hacked to comment off the "background:none" line which then had the desired effect, but this is not what I want to do in production.

I just found another question (how-do-i-override-css-styles-in-the-documentation-theme) , where the answer was given to modify or clone the document theme and do what the requestor wanted to do (which is de jure a new theme), but this is not really what I want to do, as I would no longer get Atlassian's support.

I don't know whether there is a way to undefine an existing style attribute?

Maybe I should raise an issue against the Document Theme, if I can't fix this myself?

David Simpson Community Champion Jan 04, 2012

You won't be able to "unset" just that rule yourself with an override.

The only way of doing it would then be to reapply all the other styles again. This is surely more horrid than hacking the theme jar.

Raising an issue could be the answer. If you hack the Documentation Theme, be sure to increment the version element in the pom.xml, otherwise the changes may not be noticed (because it's a bundled plugin).

I have opened a JIRA issue: ANSWERS-436

though it may be in the wrong queue. Hopefully someone moves it to the appropriate place. (project)

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

521 views 19 11
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you