Solved

external style sheets hlep

Posted on 2006-06-18
6
145 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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 …
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

939 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now