Results 1 to 7 of 7

Thread: Having one CSS for several HTMLs

  1. #1
    Join Date
    May 2005
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Having one CSS for several HTMLs

    I need to make one CSS with all the properties (text, size, color, scrollbar) for all my HTMLs, so that I won't need to edit each page If I think of changing the layout. This way I'd need to edit only that CSS.

    This is the layout properties:

    <style type="text/css">
    <!--
    td {
    font-family: arial;
    font-size: 8pt;
    color: #000000;
    letter-spacing: 1px;
    line-height: 150%;
    }
    a:link {
    color: #008000;
    text-decoration: none;
    font-size:8pt;
    }
    a:visited {
    color : #666666;
    text-decoration : none;
    font-size:8pt;

    }
    a:hover {
    text-decoration: underline;
    font-size: 8pt;
    }
    BODY {
    SCROLLBAR-FACE-COLOR: #ffffff;
    SCROLLBAR-HIGHLIGHT-COLOR: #cccccc;
    SCROLLBAR-SHADOW-COLOR: #cccccc;
    SCROLLBAR-3DLIGHT-COLOR: #ffffff;
    SCROLLBAR-ARROW-COLOR: #008000;
    SCROLLBAR-TRACK-COLOR: #ffffff;
    SCROLLBAR-DARKSHADOW-COLOR: #ffffff;
    }
    -->
    </style>

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,946
    Thanks
    43
    Thanked 3,193 Times in 3,156 Posts
    Blog Entries
    12

    Default

    For that, you need to make up an external file (a text editor is fine for this), lets call it 'main.css'. It can have any name but the extension should be '.css'. Then put your declarations in there without the opening and closing style and comment tags, in other words remove:
    Code:
    <style type="text/css">
    <!--
    and:
    Code:
    -->
    </style>
    Then on each page you want the styles to apply, put this in the head:
    Code:
    <link rel="stylesheet" href="main.css" type="text/css" />
    Make sure the href points to the actual name and location of your external file relative to each page this statement is on. The above statement is fine for an external file named 'main.css' in the same directory as the page(s) that are using it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    May 2005
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Oh.. you rock jscheuer1..!
    Thanks a lot and keep up!

  4. #4
    Join Date
    May 2005
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    (!)
    I've just tried that but it's not working! What's wrong?!

    Here is the code:

    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Main Content</title>
    <base target="_self">
    <link rel="stylesheet" href="main.css" type="text/css" />
    </head>

    I've made a CSS file in the same directory with the name "main.css", here is what's in it:

    td{
    font-family: arial;
    font-size: 8pt;
    color: #000000;
    letter-spacing: 1px;
    line-height: 150%;
    }
    a:link {
    color: #008000;
    text-decoration: none;
    font-size:8pt;
    }
    a:visited {
    color : #666666;
    text-decoration : none;
    font-size:8pt;

    }
    a:hover {
    text-decoration: underline;
    font-size: 8pt;
    }
    BODY {
    SCROLLBAR-FACE-COLOR: #ffffff;
    SCROLLBAR-HIGHLIGHT-COLOR: #cccccc;
    SCROLLBAR-SHADOW-COLOR: #cccccc;
    SCROLLBAR-3DLIGHT-COLOR: #ffffff;
    SCROLLBAR-ARROW-COLOR: #008000;
    SCROLLBAR-TRACK-COLOR: #ffffff;
    SCROLLBAR-DARKSHADOW-COLOR: #ffffff;
    }
    Last edited by Haisook; 09-24-2005 at 06:08 PM.

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,946
    Thanks
    43
    Thanked 3,193 Times in 3,156 Posts
    Blog Entries
    12

    Default

    If all is as you say it is and I haven't missed any errors in the contents of main.css, then it is truly a mystery. There could always be something that you are not mentioning. Did you try refreshing the page a few times? Do any of the styles work? Is your page xhtml? Best to put up a demo on the web for me to check out:

    PLEASE: Include the URL to your problematic webpage that you want help with.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    May 2005
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Sorry, it worked.
    It seems I just renamed the file to .css instead of actually turning it into a CSS format using Frontpage.

    Sorry for confusing you
    and thanks again

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,946
    Thanks
    43
    Thanked 3,193 Times in 3,156 Posts
    Blog Entries
    12

    Default

    That isn't really necessary but, with Frontpage, nothing of that nature would surprise me. I do virtually all of my web coding with a text editor and have never needed to 'turn a file into' anything by any means other than coding it properly and naming it properly - Java (not to be confused with javascript) and Flash, which need to be compiled, and images excepted.

    Glad it is working for you!
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •