• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Globally Changing all Instances of a CSS Style to Another

New Here ,
Jan 04, 2008 Jan 04, 2008

Copy link to clipboard

Copied

I'm working with RH6 (HTML). I'm curious if there is a method/tool that will allow me to take all instances of a certain CSS style and replace it with another (e.g., in the same manner that you can using FrameMaker and Paragraph/Character Styles). I'd like to be able to do it project-wide, but if it has to be done on a topic-by-topic basis, that would be OK... I'm just trying to avoid the need to locate each instance of the style and manually change it.

Any help would be greatly appreciated!

Views

767

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 05, 2008 Jan 05, 2008
There's nothing like that built into RH or any other HTML editor I can think of.

You could do it using a multi file find and replace tool but I wouldn't use the one that ships with RH. Also, whatever you do, make sure you create a full backup before you start.

If you wanted to change all instances of say <h1> to say <h2> that would be your search and replace. Don't forget to change the closing tags as well.

Perhaps more likely you will want to change something like class="red" to class="green...

Votes

Translate

Translate
Community Expert ,
Jan 05, 2008 Jan 05, 2008

Copy link to clipboard

Copied

There's nothing like that built into RH or any other HTML editor I can think of.

You could do it using a multi file find and replace tool but I wouldn't use the one that ships with RH. Also, whatever you do, make sure you create a full backup before you start.

If you wanted to change all instances of say <h1> to say <h2> that would be your search and replace. Don't forget to change the closing tags as well.

Perhaps more likely you will want to change something like class="red" to class="green". That only affects the opening tag.

If you use a tool such as FAR from http://www.helpware.net you can either let it blast through all the topics or you can monitor each instance of the tag and change it or skip it.

Help others by clicking Correct Answer if the question is answered. Found the answer elsewhere? Share it here. "Upvote" is for useful posts.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jan 05, 2008 Jan 05, 2008

Copy link to clipboard

Copied

Hi all

Personally I find myself scratching my bald head and asking if my "simpleton" view of things is getting in the way with this. Why? Well, it would seem to me that the obvious answer to what was asked would be to simply configure the undesired style so it matches the desired style. Once you updated the style sheet, both styles might use different names, but would look identical.

Just a thought... Rick

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 05, 2008 Jan 05, 2008

Copy link to clipboard

Copied

Maybe to change the names from something meaningless to something meaningful so that applying the styles in future is easier? For example, class="two" to class="indent".

I agree changing the style definition is easier if that is all that is needed, after all, that is the beauty of stylesheets. However, I worked on the basis that there might be other reasons.

Help others by clicking Correct Answer if the question is answered. Found the answer elsewhere? Share it here. "Upvote" is for useful posts.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jan 05, 2008 Jan 05, 2008

Copy link to clipboard

Copied

LOL, see! I knew there was something I was missing!

Thanks Peter. Not sure why I wasn't seeing that. Must be the meds. Or I suppose it could be the alcohol. Or maybe just me!

cheers all... RiCk

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 06, 2008 Jan 06, 2008

Copy link to clipboard

Copied

You raised a good point that I hadn't covered. At least now Vernholio can see both points of view and make the right choice.

Help others by clicking Correct Answer if the question is answered. Found the answer elsewhere? Share it here. "Upvote" is for useful posts.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jan 07, 2008 Jan 07, 2008

Copy link to clipboard

Copied

I probably don't have the same combination of meds and alcohol as Rick does, but my take on Vernholio's original post is this: HUH?

1. If you have created CSS styles within the HEAD section of every topic (not good practice): shame on you! You'll just have to change every instance, one at a time, as Peter and Rick have stated.

2. If you have created CSS styles in an external style sheet file (best practice): good for you! You only have to change the one CSS instance in that file and the change will ripple (cascade: see below) through all topics assigned to it.

Cascading Style Sheet (CSS): Internal styles at the topic text override the styles in the topic's HEAD section, which override the styles in an external style sheet.


Good luck,
Leon

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 07, 2008 Jan 07, 2008

Copy link to clipboard

Copied

Maybe it would help if Vernholio came back and clarified the requirement.

Help others by clicking Correct Answer if the question is answered. Found the answer elsewhere? Share it here. "Upvote" is for useful posts.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 07, 2008 Jan 07, 2008

Copy link to clipboard

Copied

Hey guys... thanks for the feedback. For starters, I have created an external CSS (using RH)... So, I'm good there. Anyway, my scenario is similar to what Peter pointed out: I used a bad naming convention for a style, and applied it to a bunch of content pages, and later came up with a better naming convention (and a better set up for the style -- I know, I know... poor planning on my part). I began applying the new style in future documents, and I'd like to apply the style to all applicable instances in the existing pages. So, I was wondering if a tool/utility existed that would allow me to do so (since one does exist in FrameMaker).

I could just let it go, but we intend to hire a new writer in the near future, and I don't want that person to have to deal with my inconsistency (not to mention, it would make things a little easier when outputting to Word, in that I'll have fewer styles to manage).

The concept of performing a search/replace for all instances of the offending style name in the HTML files is a good one, and I could try that (why are the simple solutions always the hardest ones to realize?) Anyway, I'm assuming that all I would need to do is perform a search for "<span class=Old_Style_Name>", and change them all to "<span class=New_Style_Name>", correct? And you recommend, "FAR" to do that?

Again thanks for the recommendations!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 07, 2008 Jan 07, 2008

Copy link to clipboard

Copied

You got it!

There are other tools but in my opinion FAR is the best. It's low cost and has a good trial period.

Help others by clicking Correct Answer if the question is answered. Found the answer elsewhere? Share it here. "Upvote" is for useful posts.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jan 07, 2008 Jan 07, 2008

Copy link to clipboard

Copied

And the beauty of FAR is that it will pick up on (and fix) multiple-line strings!


Good luck,
Leon

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 07, 2008 Jan 07, 2008

Copy link to clipboard

Copied

Hey Guys... Thanks a lot for the tips. Simply changing the "<span class=style_name>" tags to the approproate style worked beautifully!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 07, 2008 Jan 07, 2008

Copy link to clipboard

Copied

Oh... on a side note, I thought it might be worth pointing out that it was a Character Style that I needed to replace, and this method worked great (i.e., it wasn't a Paragraph Style). I wonder if a swap using this method for certain Paragraph Styles might create a problem (bulleted list-type Paragraph Styles come to mind)...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 08, 2008 Jan 08, 2008

Copy link to clipboard

Copied

LATEST
See my first reply. That was what I was describing there. Let me know if not clear.

Help others by clicking Correct Answer if the question is answered. Found the answer elsewhere? Share it here. "Upvote" is for useful posts.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
RoboHelp Documentation
Download Adobe RoboHelp