Difenrent backgound css for each Categories possible?

Hi

Anyone know thread in the forum or quickly hack to atribut diferent background for each categories with .css for version 2.x.

if catid=20==style20.css



ex:

if (isset($category_id == '1' ) {
$css_files = 'stylesheet_cat1.css';
} else if ( isset($category_id == '2' ) {
$css_files = 'stylesheet_cat2.css';
} else {
$css_files = 'styles.css';
}




many thanks

Yes,



```php

....
```

This way you will have a div with id (or class) "category_205" and you just have for CSS:

```php
#category_205 {blah}
#category_206 {blah}
#category_207 {blah}
#category_208 {blah}
```

You might not want to have different CSS files because they (if work correctly) get cached and introducing new CSS files will make more downloads and more load times. You may want a single CSS file that gets downloaded once and get cached than small css files all over the website that are not cached in the beginning...


{if $category_id == '1'}
stylesheet_cat1.css
{elseif $category_id == '2}
stylesheet_cat2.css
{elseif $category_id == '3}
stylesheet_cat3.css
{else}
stylesheet.css
{/if}

Many tanks for all :wink: realy helful , I must test and analyse repercution.



saludos :slight_smile:

thanks sno and texas for the skud ,but no issue:(

How to use different header background based diferent class for different categories

in main.tpl I have this code:


```php {/if}


{hook name="index:main_content"}
{include file="top.tpl"}

{/hook}



{if $top|trim}

{$top}

{/if} ```

the css class is:
```php #header {
background: #92106e url(images/header_bg.png) repeat-x left top; ```

I don't know the corect syntax
if category id=225 $header_class = 'header_225'
>

thanks