SitePoint Sponsor

User Tag List

Results 1 to 10 of 10

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2009
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    excellent css code

    Hi
    Im not sure Im posting in the right area, but here goes,

    Iv come across a really good website thats used excellent css or I think good use of html pages to program a site to have a different coloured theme each time you click onto the company logo, or just generally click on to the homepage.
    When you click on the logo it changes to i.e blue, green , etc and a few other elements on the page and a number of pictures on the top right hand corner.

    However I have been trying to suss out the code but how can you have mulitple home pages (you can only save one document to home.htm)
    that contain the <link rel="stylesheet" type="text/css" href="17.css" media="screen" /> where the different themes are.

    I dont get it.

    i would like to post the link but Im not sure if i can as it belongs to a web design agency but Im just exploring and looking at different types of cool websites to build as I want to build one for my own business.


    any help or suggestions ?

    amzie

  2. #2
    SitePoint Evangelist
    Join Date
    Apr 2009
    Location
    South Carolina
    Posts
    458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is likely they are changing the CSS. Check css Zen Garden: The Beauty in CSS Design for a site that has something like what you are describing. To get a different CSS each time, you are likely storing something with a cookie.

    I did something similar when a friend wanted to see what his site would look like with different colors. He could visit his site, and click on a link to change the look of his site.
    Each day is a learning experience.

  3. #3
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by amzie View Post
    i would like to post the link but Im not sure if i can as it belongs to a web design agency but Im just exploring and looking at different types of cool websites to build as I want to build one for my own business.
    Post the link amzie
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  4. #4
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,821
    Mentioned
    34 Post(s)
    Tagged
    2 Thread(s)
    it could be a very simple jquery trick... done by changing the root element's ID or CLASS... maybe even a stylesheet refresh?

  5. #5
    SitePoint Enthusiast
    Join Date
    Dec 2009
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok here goes guys

    Belgrade Theatre, Coventry :: Box office - 024 7655 3055

    i just the love the way the theme changes any ideas on how i could do this

  6. #6
    SitePoint Addict dnordstrom's Avatar
    Join Date
    Jul 2006
    Location
    Amsterdam
    Posts
    337
    Mentioned
    18 Post(s)
    Tagged
    0 Thread(s)
    Can't see any Javascript. Seems it's using server side scripting to specify a different stylesheet as the page loads. 3.css, 5.css, 6.css and so on.
    Daniel Nordstrom. of. Nintera(ctive)
    -- Featured post: Part 2. Writing NI.JS JavaScript
    ----- Follow me on Twitter. Got project? Contact me.
    -------- SitePoint: Community Guidelines Be A Great Member

  7. #7
    SitePoint Addict bronze trophy AllanP's Avatar
    Join Date
    Sep 2010
    Location
    Australia
    Posts
    298
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    This small script, loaded into the head of your document will randomly write a <link> to either css_1.css or css_2.css. The problem with it is that you are likely to get a string of the same css files (eg: 1,1,1,1), rather than first one, then the other (eg: 1,2,1,2). To achieve a sequential cycle you would need to store the previous selection in some way. A possibility is a cookie.

    Code JavaScript:
    <script type="text/javascript">
    <!--
    var randNo=Math.floor(Math.random()*2)+1;
    document.write('<link rel="stylesheet" type="text/css" href="css_'+randNo+'.css">\n')
    //-->
    </script>

  8. #8
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,821
    Mentioned
    34 Post(s)
    Tagged
    2 Thread(s)
    Maybe we are going about this, literally, the wrong way. It could have been javascript or jQery, but... it could also have been PHP. However when you think about it, loading as separate style sheet per page just to change the logo, seems like overkill. you could achieve the same result by creating separate rules ofr each logo color, #logo1, #logo2 , #logo3... all in the same stylesheet code give the logo in each page a corresponding ID.

    you could use session variables to co code a sequence in PHp, if that's what you want

  9. #9
    SitePoint Enthusiast
    Join Date
    Dec 2009
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, but its not just the logo its the column on right hand side and small image on the top right hand corner.....



    Quote Originally Posted by dresden_phoenix View Post
    Maybe we are going about this, literally, the wrong way. It could have been javascript or jQery, but... it could also have been PHP. However when you think about it, loading as separate style sheet per page just to change the logo, seems like overkill. you could achieve the same result by creating separate rules ofr each logo color, #logo1, #logo2 , #logo3... all in the same stylesheet code give the logo in each page a corresponding ID.

    you could use session variables to co code a sequence in PHp, if that's what you want

  10. #10
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    I would be inclned to agree with dresden becuse there is no immediate switch which you would have with Javascript, the changes are all on page refresh and there is nothing to suggest JS in the source code.
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....


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
  •