Treehouse: Grow your CSS skills. Land your dream job.

If body id call css

  • # February 12, 2010 at 3:43 am

    Hi guys, I am new here, so I have a big problem.

    I need css switching for deferent body id.
    for instance:
    body id="car" ->
    body id="pane" -> plane.css

    Problem is I have only one header (joomla) so I need some kind of switch.

    10x :D

    # February 12, 2010 at 5:09 am

    You only need one CSS file. Then in that file you target specific things with the body id.

    #car #content {


    #planes #content {



    # February 12, 2010 at 7:48 am

    You didnot understand me!
    Of course I know that,
    I have several sub sites, under 1 site, and for each one I need to import another css file.

    So, I can put it all in 1 css file and make junk of 60-100 Kb, or do something elegant and put script wich says,
    if body id="car" import
    if body id="plane" import plane.css

    I dont need one css file in wich I am going to override 10 rules!

    # February 12, 2010 at 8:36 am

    css doesn’t have programming features. so it’s not possible to make a if statement and load a file

    you could do it with php

    # February 12, 2010 at 9:41 am

    You could do it with JQuery by looking for the body ID and then including the CSS file based on the ID (although this will not work for people without Javascript).

    Or, you could play around with PHP in CSS

    # February 12, 2010 at 10:19 am

    OK, I know all this.

    Thats why I need php function to do this :roll:

    # February 12, 2010 at 10:36 am

    Then I suggest you post your question in the PHP section not in the CSS forum, you might find the solution there. :?

    # February 12, 2010 at 10:41 am

    I would also suggest you keep your temper, from what seems like a very aggressive second post to someone who was just trying to help you out.

    To lessen your frustration you might want to spend a some time explaining a little better the problem you are having.

    Remember the issue is you and your knowledge, not anyone else’s answers to your vague question.

    # February 12, 2010 at 11:54 am

    cool !

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.