Results 1 to 9 of 9

Thread: Lord of the Rings or 300? What is your strategy?

  1. #1
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default Lord of the Rings or 300? What is your strategy?

    When using CSS files for your website, do you find it better to be LotR or 300?

    Do you have one CSS to rule them all, who cares about file size, or

    Do you have many many smaller css files and link to the needed one(s) on each page as you see fit?

    Currently I have 7 CSS files for one site, and I find it a bit ridiculous. I was thinking of paring it down to one really long one. What do you all think?
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I'd recommend having as few as you can, though not overloading any.

    You load a CSS file with 20 extra properties not used on a page... why?

    There are a few options to make things more efficient:

    1. Design a standard CSS file for your whole site. Include this on every page. Then make files for any sections or individual pages that you want custom things on. Then use a couple on a page.

    2. Use PHP to generate different stylesheets based on need. I put a quick tutorial on that in the tutorials section if you'd need help figuring out how (though you probably don't).
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I use one long one, unless it's really huge or contains styles I know I'm never going to need on any other page.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    I would like to do just one. Part of my issue is that I have 3 main body places of my site, and the only difference between them (as far as CSS is concerned) is the background color and font color/size.

    Now if I could find a way to use 1 CSS file with 3 body {} sections I would do that.

    It still doesn't solve my 7+ current CSS files, I need to whittle those down, I guess either 3 max, or I need to find something uniform for the body{} and just go with one.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You can apply a class or ID to the body.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    OOOOO... Yeah I forgot about that! I will have to give that a try...
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  7. #7
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    if you do not want to do that you could also have separate style sheets just for the color difference, so you would include the appropriate body style according to some action item (url)

    PHP Code:
    __DOC_TYPE___
    <html>
    <head>
    <?php 
    if($var == $val) { include_once("/css/body-green.css"); } 
    else if(
    $var2 == $val2){ include_once("/css/body-blue.css"); } 
    else { include_once(
    "/css/body-gray.css"); } 
    ?>
    <link type="text/css" rel="stylesheet" href="/css/styles.css" media="all">
    <title>TITLE</title>
    </head>
    ...
    where the body-color css files contain

    Code:
    body {
         background-color: #00ff00;
    ...
    }

  8. #8
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Thanks for that. I will keep it in mind. Although I will probably be better off with leaving the URL alone.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  9. #9
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You could also use PHP to generate the stylesheet and pass a GET variable.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •