Using multiple stylesheets in a project

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
LesNoiz
Propeller Head
Posts: 35
Joined: Fri Jun 15, 2012 12:23 pm

Using multiple stylesheets in a project

Post by LesNoiz »

I have a project where all but two topics use the same stylesheet. I've defined a master stylesheet at the project level. When I try to assign a different stylesheet to the two topics, I'm told I'm not allowed because I've defined a master project stylesheet. As a workaround, I can get rid of the master project stylesheet and assign the stylesheet at the topic level, but this seems overly laborious. Is there a way to assign a default stylesheet at the project level that will be used if none is defined at the target or project level? Any guidance is appreciated.
i-tietz
Propellus Maximus
Posts: 1219
Joined: Wed Oct 24, 2007 4:13 am
Location: Fürth, Germany

Re: Using multiple stylesheets in a project

Post by i-tietz »

You can make the two topics use a different masterpage and insert a different stylesheet into it or simply insert the styles you want to change into the head of that masterpage.
Inge____________________________
"I need input! - Have you got input?"
LesNoiz
Propeller Head
Posts: 35
Joined: Fri Jun 15, 2012 12:23 pm

Re: Using multiple stylesheets in a project

Post by LesNoiz »

Thanks for the reply. I tried adding the following to the <head> section of both a topic-specific master page, and to the topic itself:
<style>
body
{
margin-bottom: 10px;
margin-top: 10px;
margin-left: 10px;
margin-right: 10px;
}
</style>

Unfortunately, in both cases, the statements above appear BEFORE the following statement in the output:
<link href="Resources/Stylesheets/MyCSS.css" rel="stylesheet" />
and are thus overridden.

Anyone know how to make this work (ie how tho make the statements appear AFTER the CSS declaration)?
i-tietz
Propellus Maximus
Posts: 1219
Joined: Wed Oct 24, 2007 4:13 am
Location: Fürth, Germany

Re: Using multiple stylesheets in a project

Post by i-tietz »

Really? Didn't know - sorry about that.

Do you really just want to change the body?
Then dump the masterpage and generate a class for the body in the normal stylesheet:

Code: Select all

body.margin10 { margin: 10px; }
You can assign that class to the body in those topics ...


If you need more than just the body you can still get away with assigning only the body class in the topics, but you would need to generate complex selectors and declare the wanted styles like this:
for the p tag: body.margin10 p { styles go here }
for the table tag: body.margin10 table { styles go here }

You have to make sure that each complex selector is in the stylesheet after its "ancestor", because otherwise the declaration for the ordinary p tag overrides the complex selector one.
Inge____________________________
"I need input! - Have you got input?"
LesNoiz
Propeller Head
Posts: 35
Joined: Fri Jun 15, 2012 12:23 pm

Re: Using multiple stylesheets in a project

Post by LesNoiz »

Yeah, really. Your suggestion to use a class should work however. Never thought about that. Thanks!
Post Reply