Log in

View Full Version : Need Help With Stylesheet Pls



renzariche
09-08-2009, 03:18 AM
Hey, I'm working on a website for my family and relatives back home to share photos and videos...etc.

I've found some really good scripts on this site that I've been trying out, so I was just wondering if its possible to add as much scripts into my stylesheet so I wouldn't have to add every scripts into every new pages I make.

For example, all my pages are starting to look like this:

In head section:
<link rel="stylesheet" type="text/css" href="/stylesheet.css" />
<script type="text/javascript" src="/menu_fade.js">
</script>

In body section:
<body topmargin="0" leftmargin="0">

(and the end of body):
<script type="text/javascript">
gradualFader.init()
</script>

Not sure if I'm not clear enough on what I'm talking about. Anyway, Ill be waiting for replies. Thanks.

forum_amnesiac
09-08-2009, 06:38 AM
Don't mix up CSS and javascript.

You put your style in a css file, eg

body {
margin-top:0;
margin-left:0;
}

You add the other styles you are going to use into this file.

As to javascripts, you can put them all into the external file, but you will still need to call them in the appropriate place in your HTML.

A way to ensure that you keep a consistent page look is to create a template document, ie a page that has all the basics in it - header/footer scripts, etc, and use that as the starting point for all of your pages.

Hope this helps

EisBear
09-08-2009, 10:31 AM
<link rel="stylesheet" type="text/css" href="/stylesheet.css" />
The LINK tag is closed !!! (some tags do not need a closing tag, so the <script> is not within a <link> tag in your code.

renzariche
03-04-2011, 06:11 AM
Can someone else delete my post?

djr33
03-04-2011, 03:57 PM
I have removed all instances of your domain name from your post (I am guessing this is why you want it deleted). However, it's best to keep old posts in case someone has a similar question.

Note: using http://yourdomain.com/ or just / as the prefix for a path to a file is equivalent in almost all ways, so the code above will still work if someone would like to refer to it.