golivebasics.com home page

Cascading style sheets part 5 - external style sheets from internal ones

If you make all your pages by doing a 'Save as' from the basic one, they will all have the same internal style sheet. But you might not want to make your pages that way (although it beats stationeries hands down in my view) and if you change your mind about how things should look, you're in for a ton of work.

So, if you're happy with your internal style sheet and want to use it on other pages, you can turn it into an external one.

Page 1 - why css?
Page 2 - an internal style sheet; about fonts
Page 3 - define some elements; elements vs classes
Page 4 - more elements; some classes
Page 6 - an external style sheet from scratch
Page 7 - different coloured links on a page
Page 8 - paragraph spacing
Page 9 - learn more
Staircase icon again - you'll see something like this:
Control-click in the css editor to get this option:
When you let go you'll see this:

Golive is offering you the chance to save your style sheet into your main site folder (alongside your pages etc, not anywhere special), and highlighting the fact that it's currently called 'untitled.css'.

Be careful the location you are being offered is the right one, navigate to it if not.

Overtype 'untitled' but leave .css alone. I've called mine main.css.

Now you can link that style sheet to any page(s). An easy way is to close your page and open another one, being careful the site window is visible (you don't ever work without a site file open do you? you do? and you never wondered why all that green slime is oozing out of your computer and your hair turned purple? please don't do it!).

I'm not really joking, working without a site file open really, really confuses Golive and causes havoc. End of lecture.

Now just drag main.css, or whatever yours is called, onto the page icon - like this:

The good news: you can link an external style sheet to a page that's not open - or to several at once - like this:

In the site window, select a page, or shift-click to select several.

Look in the css palette (remember, not the css editor, I know, I know ...)

Now you can point and shoot, or use the drop-down, to choose which external style sheet to link to the page(s) you selected.

You can link more than one style sheet to a page, but then we get into the 'cascading' stuff and what takes precedence over what - I'd keep it simple for now.

To remove the link to an external style sheet from an open page, turn down the triangle by the page icon to reveal the head section. Select the icon for the external style sheet. If you're not sure which it is, select each in turn and look for the name to appear. Then go Edit > Clear.

Or click the staircase to get the css editor, select the style sheet and zap it via the trashcan.

From closed or multiple pages, select the page(s) in the site window and use the css palette to remove the style sheet.

More good news - you can double click your external style sheet, with or without a page open, and change it via the inspector. The changes apply to all linked pages (remember to reupload your changed style sheet next time you upload your site, no need to reupload the pages if they haven't changed).

Even more good news - if you had that annoying glitch with combined element styles, where the css doesn't show up properly in layout view, it should be gone. I don't see that problem with external style sheets - and I never use internal ones any more so I'd forgotten about it, sorry.

Maybe you don't get the problem anyway, in which case ignore my ramblings (it's the green slime .....)

A bit of not so good news ... it's best to remove an internal style sheet if you're just using an external one instead (until you've studied up on all that precedence stuff at least). Otherwise you'll be editing away in the external style sheet, and your internal one will be over-ruling it all the time - very confusing.

Good news!

Thanks to Adam at Golive in 24 Hours for this tip: (the book is excellent too)

You can delete an internal style sheet easily in Golive 6 - just turn down the triangle to display the head section, find the style sheet - drag it to the Finder trash! It looks like this. See below.

OK, on to making an external style sheet from scratch, a necessary fix for Netscape 4 with css, and some links to where you can learn more ... it gets easier ...
golivebasics.com home page