Multiple stylesheets, getting confused, need help

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
sds
Propeller Head
Posts: 48
Joined: Tue Jun 26, 2018 11:29 am
Location: Tucson

Multiple stylesheets, getting confused, need help

Post by sds »

I'm a little lost and need some guidance. I feel like this question is asked in about 6 different ways every day, but I couldn't find the answer I needed in any previous thread.

I have an existing project that I've always only used one stylesheet (hereafter MainStyles.css), other than the StylesForHomePage.css which is only applied to the Home.htm file.

Some new topics have emerged in the project where I want 90% of the same styles as MainStyles.css, but I wanted the Drop Down to be colored, where they're uncolored in MainStyles.css. I felt like applying a local stylesheet that had the colored Drop Down look to these handful of topics would be simpler than trying to apply the colored style one Drop Down at a time on each topic (these particular topics are FAQ related so there are several, if not dozens, of Drop Downs on each topic).

I started by creating a new stylesheet that lives in the typical Resources\Stylesheets folder. I used MainStyles.css as the template, renamed it (hereafter SupportFAQ.css), changed the MadCap | dropDownHotspot font color, and applied it locally to the topics I wanted in the Topic Properties tab of the Properties dialog. My Project Properties has always been set to MainStyles.css, with 'Allow Local Stylesheets' activated.

When I previewed all topics (including the ones I did NOT apply local stylesheet to), they all look great. They look great in the editor and in Flare's preview window. But when I build it, ALL of my other topics are using the new Drop Down color. When I open all of the other topics' Properties dialog, they all point to the MainStyles.css.

Here's what I've tried:

1. Changing Master Stylesheet in the Defaults tab of the Project Properties to MainStyles.css (plus 'Allow Local Stylesheets').
2. Going to the Target and setting the Master Stylesheet to MainStyles.css (plus 'Allow Local Stylesheets').
3. In the Text Editor of the new SupportFAQ.css file, I've commented out the @namespace MadCap url.... (which wasn't in my MainStyles.css that I remember) and the @import Google API font that came over from MainStyles.css. NOTE: I did this because every time I added the SupportFAQ.css to a topic, I got a message about circular css.
4. Combinations of everything.

Right now: My Project Properties is set to (default). My Target is set to MainStyles.css.

The only other lead I have is that I may have edited something deeper down into the files. When I build it in a browser and inspect the elements, I can see .dropDownHotspot:link and it has the color applied. It's pointing to Topics.css, which is buried on my computer.

So is there something else I should be doing to accomplish what I want?
Chicago_HPT
Sr. Propeller Head
Posts: 133
Joined: Sun Feb 03, 2013 6:01 pm

Re: Multiple stylesheets, getting confused, need help

Post by Chicago_HPT »

I think you're close but there may be a simpler way. Import the MainStyles.css style sheet into the "specialist" style sheet, and then customize the selectors (styles) in the new sheet. For styles that already exist in MainStyles, changes you make in the new style sheet will override existing values. I just ran a test and it worked nicely. I use the text editor but here are the steps for the Basic View of the Flare style editor. It's easier done than said (or written):
  1. Set the 'Allow local stylesheets' options in the target and anywhere else you might need them (sorry, not 100% sure where).
  2. Create a new style sheet. I created it in the main Stylesheets folder.
  3. Open the style sheet.
  4. From the Options menu, select Stylesheet links. A dialog appears.
  5. If there are any style sheets listed on the right side, select them and click the left arrow in the middle of the dialog. The selected stylesheet moves to the Stylesheets list on the left. Do this for everything listed on the right until there are no links listed on the right.
  6. Now look on the left for style sheets you want to link, for example, MainStyles.css. Click the style sheet on the left and click the right arrow to move the style sheet to the right. This links the styles to the style sheet but anything you do in the new stylesheet overwrites ("has precedence over") conflicts with linked styles.
  7. Click OK to close the dialog.
  8. In the new style sheet, make changes or add new styles as desired and then save your changes. Flare only applies the saved version of style sheets, something that still catches me on occasion. :oops:
  9. Open the properties for the topics that you want to use the new style sheet, and on the Topic Properties tab, select the new style sheet in the Stylesheet field. Recommendation: if you're going to do this to multiple topics, consider making a custom template and assigning the style sheet to the template. For info on making templates (it's easy), see the Flare online help if necessary.
Your "specialized" css should take precedence AND all your existing styles are preserved and you don't have to make copies of them in the new style sheet, which could be a maintenance nightmare.

I hope that helps,
-jeff
Post Reply