Hi!
I'm trying to apply CSS to the confluence using both the global stylesheet page and space-specific stylesheet pages. Nothing seems to have any effect!
I'm testing with the following basic CSS and nothing happens:
h2 {
color: red;
}
.div {
background-color: red;
}
Please help!
Another maybe slightly hacky approach would be to externally host your CSS file...
In Confluence Admin | Look & Feel | Custom HTML
...reference your external CSS in At the end of the HEAD
<link rel="stylesheet" type="text/css" href="protocol://server/path/to/style.css" />
In the external CSS, prefix all your styles to be documentation theme specific, e.g.
body#com-atlassian-confluence.theme-documentation h2 { /* formatting here */ }
As your CSS is loaded last, it will overide the default. The stylesheet would be loaded for all themes, but body#com-atlassian-confluence.theme-documentation prefix will target the documentation theme only.
This approach overcomes problems such as the global custom stylesheet not being displayed when the Documentation theme is not the default theme.
Sure, why not. Reduce to...
<link rel="stylesheet" type="text/css" href="/path/to/style.css" />
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, you should be able to reference an attachment on a page, however this will lead to it not having been given the headers that are required to ensure the browser caches it (since most often when you want an attachment you want to do the opposite - IE ensure that the copy you download is the latest version)
You can also store files in the images folder (the same place confluence gets many of it's icons from)
A final alternative would be to use a theme that is deliberatley designed around being customised - theme builder is a good example of this, however it has a pretty steep learning curve. Refined Wiki can also be customised to some extent.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Alternatively you could simplify David's answer by writing your css into the head instead of linking to a style sheet. This would work well for those who can access the Confluence admin section but cannot add resources to the filesystem.
Example (In Confluence Admin | Look & Feel | Custom HTML | HEAD):
<style type="text/css"> #header { background-color: #cc3300; } </style>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
All of the above answers go way too far.
You just need to set the style for ".wiki-content h2" instead of just "h2":
.wiki-content h2 {
color: red;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is exactly what I needed! Way simpler than some of the other answers. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I so agree. The existing CSS is way too old-fashioned. The editor doesn't offer many options either. It becomes very difficult to create an interactive technical document.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Depending on confluence version, global css will not be applied unless you are using the default theme.
Also to make your styles apply you will need to use css that is more 'specific' than that supplied by confluence, for example if you want to make a div and then style it you would need to refer to the css class applied to the div, eg:
{div:class=mydiv} some content {div}
with css
div.myclass { background-color: red; }
Note that in css the 'type' of the element goes before the . and the classname applied to the element comes after, so your example css would apply to elements of all types whose css classname was 'div'.
You may find the w3schools tutorial pages handy: http://www.w3schools.com/css/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The other way to do it is...
There is a CSS file within the doctheme jar called splitter.css. That contains the CSS for the theme. If you overwrite that will all you need you should be good to go.
Extract, the atlassian-bundled-plugins.zip
Extract doctheme-1.9.jar (or whatever version you have)
Edit the decorators in \doctheme\decorators
Edit the CSS in \doctheme\splitter-1.5.1
zip the files up again to doctheme-1.9.jar, overwrite to old one and zip up atlassian-bundled-plugins.zip..
Put atlassian-bundled-plugins.zip back where it goes on the server and restart.
I have done this on 3.5.3
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you are going to go to this extreme, then rather than replacing the bundled plugins zip, I would suggest also editing the atlassian-plugin.xml file and changing the 'key' of the theme - you can then upload this in the normal way and it will appear as a separate theme to the inbuilt one (making it much more convenient for updating as you develop your changes)
More information can be found here:
http://confluence.atlassian.com/display/CONF31/Creating+a+Theme
https://developer.atlassian.com/display/CONFDEV/Theme+Module
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Fair point and I think I'll do that, for the most part my response answers the question of how to modify the CSS of the documentation theme, which I didn't see answered very clearly and I had to figure it out myself. Your suggestion is a good one once you learn how to edit these themes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I changed the key and it repackaged the files, and uploaded the theme. However I cannot choose it as a theme in a Space. Not sure why.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Another maybe slightly hacky approach would be to externally host your CSS file...
In Confluence Admin | Look & Feel | Custom HTML
...reference your external CSS in At the end of the HEAD
<link rel="stylesheet" type="text/css" href="protocol://server/path/to/style.css" />
In the external CSS, prefix all your styles to be documentation theme specific, e.g.
body#com-atlassian-confluence.theme-documentation h2 { /* fornatting here */ }
As your CSS is loaded last, it will overide the default. The stylesheet would be loaded for all themes, but body#com-atlassian-confluence.theme-documentation prefix will target the documentation theme only.
This approach overcomes problems sure as the global custom stylesheet not being displayed when the Documentation theme is not the default theme.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alain:
I'm reasonably CSS proficient normally - the .div was just a typo and was meant to just be a div :)
David:
Do you mean this?
#com-atlassian-confluence h2 {
color: red;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
David:
Do you mean this?
#com-atlassian-confluence h2 {
color: red;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Confluence CSS can quite specific when it comes to heading styles ... your best bet is to use a tool like firebug to find out what is being used to apply the current style and then go one more layer more specific ... I've not done much customisation of the documentation theme since, oddly enough, we tend to use builder quite a bit :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've tried adding
#main #content .wiki-content .sectionMacro .confluenceTd h2 {
color: green !important;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It looks to me, like the contents of the global stylesheet page are not be applied to the Documentation theme at all (as in, the css file is not being referenced). So my only option currently is to copy and paste the same CSS to each space. And to update each space whenever I make a change. Is this really the suggested way of tweaking the appearance of the documentation theme?
I have been using Jquery to add inline styles using the custom HTML page - but this isn't exactly efficient either!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.