Solved

external style sheets hlep

Posted on 2006-06-18
6
151 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Printing source code 2 314
Easy way to swap image out on page load 8 184
CF Buider 2 connect to remote server 6 87
Unexpected End of File 11 54
For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

740 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