Solved

external style sheets hlep

Posted on 2006-06-18
6
140 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 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

21 Experts available now in Live!

Get 1:1 Help Now