Solved

external style sheets hlep

Posted on 2006-06-18
6
147 Views
Last Modified: 2010-04-25
hi
i have bulit a few sites in dreamweaver using CSS but have generally kept my CSS code specific to each document, in the script part of each document

i know that you can work off external style sheets but i just havent got around to working out how to do it.

now i am starting a new site i figure its a good time to work out how its done.

so could someone explain how i set this up, i want one style sheet that all my pages refer to,

i want to be able to ammend throughout design so it will update all the pages


Thanks
0
Comment
Question by:socross
  • 3
  • 3
6 Comments
 
LVL 25

Expert Comment

by:Rouchie
ID: 16932215
To reference a style sheet (in this case let's call it mystyles.css), you add a reference from within each page's HEAD tag.  Each page therefore must reference the external style sheet like this:

<head>
<title>The usual page's title here</title>
<link href="mystyles.css" rel="stylesheet" type="text/css">
</head>

0
 
LVL 1

Author Comment

by:socross
ID: 16932667
so if i set this up before i start working on a document, how can update that style sheet, if i make changes to styles will the automatically go into that style sheet

thanks
0
 
LVL 25

Expert Comment

by:Rouchie
ID: 16932688
You have to open up the style sheet and work directly in there.  I think Dreamweaver will let you edit the style from the Style menu toolbar when working with a web page, but it's easier to work directly in the style sheet file.
It's also safer to work directly in the css file.  Remember that by tweaking a style to look okay in one page, you could inadvertently mess up it's look in all the other page files!
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 1

Author Comment

by:socross
ID: 16935905
so if i create a new layer, say a menu bar that i want to have the same style accross the whole website, i create the layer in the page say index.html how can i make sure that the related css is saved in this external CSS doc, do i have to export it (if so how?) or can i set it up to save the new layers CSS in the external page. Or do i need to create the CSS within the external doc and then import it in as directed above.

If i am missing the point completly, let me know.


thanks
0
 
LVL 25

Accepted Solution

by:
Rouchie earned 250 total points
ID: 16936001
If you go into code view you will see all the styles defined for your layer.  Depending on how the code is written it might look something like this -

<style type="text/css">
.myLayer {
  width: 150px;
  height: 100px;
  display: none;
  color: black;
  background-color: #eeeeff;
  z-index: 100;
}
.otherStyles {.....whatever...
}
</style>

You can see what the class name is in Dreamweaver in the properties panel (above in my example it is called .myLayer).
If you then take out all reference to myLayer, so the code looks like this:

<style type="text/css">
.otherStyles {.....whatever...
}
</style>

And then paste the bit you took out into the CSS file:

.myLayer {
  width: 150px;
  height: 100px;
  display: none;
  color: black;
  background-color: #eeeeff;
  z-index: 100;
}

Then when you reference the CSS file from the web page, the properties will be applied back to your layer element.  The class names will still be available in dreamweaver when you are editing your pages because as soon as it sees the reference to the CSS file, it reads in all the class names (.myLayer etc) and allows them to be assigned to elements within that page.
0
 
LVL 1

Author Comment

by:socross
ID: 16936248
so as long as i make changes to CSS in the external file the main doc will be updated


thanks for all your help, took me a while to get there but its always easy when you know how.

thanks again
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Dreamweaver CS6 FTP issues 12 1,308
COLDFUSION 9 DEVELOPMENT SERVER STOPPED WORKING 9 448
change form target with jquery 2 402
Adding an Audio File (MP3) to a Website (HTML) page 2 194
I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question