Solved

external style sheets hlep

Posted on 2006-06-18
6
153 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

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…
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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

630 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