Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts

    must stylesheets use the extension .css?

    Is there an alternative file extension, that can be used as a stylesheet?

    I am thinking of something dynamic and wondered if stylesheets have to have a .css extension at all. If not then is there a list of alternatives.


    Bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Any file can have any extension - it's all about the headers.

    For example - a dynamic stylesheet could have the extension .php, and still work as a stylesheet, providing you send the right header at the top:
    Code:
    header("Content-type: text/css");
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #3
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    cool, Thanks.

    Bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #4
    Senior Coder
    Join Date
    Apr 2003
    Location
    San Francisco, CA
    Posts
    2,469
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Where do you put the header information as you posted in the code? Just at the top of any page is fine?
    // Art is what you can get away with. <-- Andy Warhol
    ...:.:::: bradyjfrey.com : htmldog : ::::.:...

  • #5
    Regular Coder
    Join Date
    Jul 2004
    Location
    mile high city
    Posts
    482
    Thanks
    0
    Thanked 0 Times in 0 Posts
    In php, at the very top before any whitespace:

    Code:
    <?
    header("Content-Type: text/css");
    header("Cache-control: private, no-cache"); 
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); //Past date
    header("Pragma: no-cache");
    ?>
    I use a dynamic stylesheet for a styleswitcher, and in addition to the content type, had to add the extra stuff becuase Opera seemed to be caching it and wouldn't reflect changes made to the dynamic stylesheet.
    Computer, kill Flanders... Did I hear my name? My ears are burning...
    Good start. Now finish the job.

  • #6
    Senior Coder
    Join Date
    Apr 2003
    Location
    San Francisco, CA
    Posts
    2,469
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Interesting... but wouldn't that defeat some of the full power of CSS (having to download a new style sheet each time)? The cache is half the fun sometimes

    PS - thanks for the quick, useful response by the way
    // Art is what you can get away with. <-- Andy Warhol
    ...:.:::: bradyjfrey.com : htmldog : ::::.:...

  • #7
    Regular Coder
    Join Date
    Jul 2004
    Location
    mile high city
    Posts
    482
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If it's a large file you're right. But if you're just changing a few rules on the fly it can be handy.
    Computer, kill Flanders... Did I hear my name? My ears are burning...
    Good start. Now finish the job.

  • #8
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't see any benefit in stopping it from caching. For your own development purposes, Shift + Relead is force-refresh in Opera. Users won't have a problem, because it's done once they see it.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #9
    Regular Coder
    Join Date
    Jul 2004
    Location
    mile high city
    Posts
    482
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by brothercake
    For your own development purposes, Shift + Relead is force-refresh in Opera. Users won't have a problem, because it's done once they see it.
    I don't think I understand

    I've been using a php styleswitcher (problems switching stylesheets) to switch between three small css files and Opera doesn't reflect the change unless stopping each from caching. This is happening when viewing off the server.
    Computer, kill Flanders... Did I hear my name? My ears are burning...
    Good start. Now finish the job.

  • #10
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    Oh no-no no no no no I don't want to change the existing/familiar functioning of a stylesheet.
    Edit: Edited for Gobbledegook!


    Where I have made a single perl program that enables the creation and presentation of a series of different dining menus, I can determine that each will have its own menu-specific stylesheet.

    But I want also, to enable the creation of a stylesheet through the browser so that colors and fonts etc can be altered to suit a specific menu style. Y'see the prog I am using creates flat files with no extension and I wanted to find out if such files could be used as css before I spent more time with this specific script.

    Then I want to bring the functionality of eight cms systems together into one package by adding a CP.

    I'm some distance off doing the GUI CP because I am overworked on creating and learning more perl programs.

    Bazz
    Last edited by bazz; 02-04-2005 at 07:36 PM.
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #11
    Senior Coder gsnedders's Avatar
    Join Date
    Jan 2004
    Posts
    2,340
    Thanks
    1
    Thanked 7 Times in 7 Posts
    For my dynamic CSS at my blog, I've got styles in the head element, so the stylesheet remains the same all the time...

  • #12
    Senior Coder
    Join Date
    Jul 2004
    Location
    New Zealand
    Posts
    1,315
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by mcdougals4all
    I don't think I understand

    I've been using a php styleswitcher (problems switching stylesheets) to switch between three small css files and Opera doesn't reflect the change unless stopping each from caching. This is happening when viewing off the server.
    That's because according to the browser and the server, you're serving the same file. The idea behind alternate stylesheets is to have different stylesheets that are de/activated by the user. This supports caching. What you need to do is append a variable to the end of the URL
    Code:
    <link rel="stylesheet" href="mystyles.css?colour=blue" type="text/css" media="screen">
    Then you give it a URL with a different variable to change the style.

    I'm fairly sure this works, though I've never bothered with it.


  •  

    Posting Permissions

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