Copy link to clipboard
Copied
Hi, I'm using Dreamweaver CS5. I have hundreds of pages to apply a basic CSS rule to, but I have to reattach it on every page instead of it showing up again in the "targeted rule" submenu on the properties tab. Advice? Thanks
well that is true that you can nest templates...
but if the structure doesn't change, and if it is just to make the groups display differently... you can use param templates for thta purpose...
it's easy to implement and use...
<!-- TemplateParam name="group" type="text" value="" -->
<body class="@@(group)@@">
Copy link to clipboard
Copied
What are you trying to attach the css rule too, can you show the bit of code?
Do you have a linked css stylesheet, common to every page, where you could insert this rule rather than physically attaching a css style to a piece of code?
Copy link to clipboard
Copied
My use of DW is very basic so I'm not sure what the difference is between linking a css stylesheet and inserting a rule...I'm just trying to make one or two words on each page a certain code of red and using css instead of just changing the type color, so I can change the color globally later if I need to.
I don't have a css stylesheet common to every page - is that something I can set up to already existing pages?
thanks in advance
Copy link to clipboard
Copied
jeanl67660933 wrote
My use of DW is very basic so I'm not sure what the difference is between linking a css stylesheet and inserting a rule...I'm just trying to make one or two words on each page a certain code of red and using css instead of just changing the type color, so I can change the color globally later if I need to.
Sounds to me the only way youre going to be able to do that is using Search and Replace given the number of pages you mention.
You're probably trying to do something like 'This is some <span class="red-text">Red Text</span> in a paragraph'
If the words or phrase you're trying to make a specific color are unique in the page its possible through Search and Replace otherwise i have not a clue how you would do that.
Its not like you want to change a specific heading in a specific container to a different color which pulls the color from a global css stylesheet.
Copy link to clipboard
Copied
Can I apply a stylesheet to many pages at once? So I can see it in the "targeted rule" dropdown menu on the properties tab, without having to add it individually to every page when it's open.
Thanks for the advice
Copy link to clipboard
Copied
jeanl67660933 wrote
Can I apply a stylesheet to many pages at once? So I can see it in the "targeted rule" dropdown menu on the properties tab, without having to add it individually to every page when it's open.
Thanks for the advice
Depends what you mean by apply a stylesheet?
You can 'link' a stylesheet to each page but just linking a stylesheet isnt going to help you as you need to apply a style within that stylesheet to something on your page.
You're looking to change the structure of your html IF you want to update specific words within a number of pages with a different color and unfortunately unless they are within include files there is really no automated process other than using find and replace,
So you might have:
'<p>The fox jumped over the lazy dog</p>' on a number of pages where you want to color the word 'jumped' in red or green or orange.
You would find the phrase 'The fox jumped over the lazy dog'
and replace it with:
The fox <span style="color: red;">jumped</span> over the lazy dog
Inline css styling (example above) is not advisable but since you have no global stylesheet attached to each page its the only way you can do what you need to do. Even if you did have a global stylesheet you still need to target the words you need to color change which you cant do if they are part of a sentence.
If you had a global stylesheet attached to each page and the words you wanted to change were within a unique html tag like <h2></h2> or <h3></h3> tag you would be able to change the color very easily.
If you do attempt to use 'find and replace' then make sure you back up your site folder as I personally would not want to use 'find and replace' on 100+ pages
Copy link to clipboard
Copied
jeanl67660933 wrote
Can I apply a stylesheet to many pages at once?
If your site is template driven, yes.
From your Files Panel, expand the Templates folder and open the Template.dwt file. See screenshots.
Place your mouse cursor inside the <head> tag. Insert a link to your external CSS file from the Tools menu. See screenshot.
Save Template and populate changes to all child pages.
Copy link to clipboard
Copied
The 450+ pages are attached to a template but within those pages I need to apply the css type color change to groups. I couldn't figure out how to make nested templates for the groups so that's why I'm doing each page individually. I just wish I could skip the extra few clicks it takes to get the stylesheet attached (even keyboard shortcuts would help but I don't see any for attaching stylesheets). Sorry such an amateur!
Copy link to clipboard
Copied
well that is true that you can nest templates...
but if the structure doesn't change, and if it is just to make the groups display differently... you can use param templates for thta purpose...
it's easy to implement and use...
<!-- TemplateParam name="group" type="text" value="" -->
<body class="@@(group)@@">
<!-- TemplateParam name="group" type="text" value="groupone" -->
body[class^=group]{ // affect all groups } .groupone { } .grouptwo { }
that's it... don't hesitate if that is not enought clear...
Copy link to clipboard
Copied
Nested Templates are a terrible idea.
If I understand this correctly, you want to change text color somewhere and have it populate to 450+ pages. That's what a global CSS file is for. Please tell us which HTML classes or IDs you have to work with? If none are specified, you'll need to create one, for example, .red.
CSS:
.red {
color: red;
font weight: bold
}
HTML:
<p class="red">This text is bold and colored red</p>
<p>This text is normal</p>
Nancy
Copy link to clipboard
Copied
Yes I wanted it to populate to 450+ files but not the same word in each page (more like 8 groups of pages among the 450).
Copy link to clipboard
Copied
did you try the solution that I have proposed ?
Copy link to clipboard
Copied
I cleaned up the organization of my remote files, and placed the .css file inside my website folder. For some reason now, I don't have to reattach the stylesheet for every page now. Thanks for all the help.