0

Hey everyone.

I haven't been on DaniWeb in a while.

.x-accordion-header {
	width: 100%;
	color: #ffffff;
	background-image: -webkit-gradient(linear,0% 0,0% 100%,color-stop(0%,#[B]96A9C0[/B]),color-stop(2%,#[B]5A7596[/B]),color-stop(100%,#[B]394B5F[/B]));
}

Is it possible to include a 'variable' or 'property' in css?

The reason why I am asking is because I want to change the background colour of the css header for multiple object types.

Say I checked for the type either via PHP or Javascript with a case statement or an IF ELSE ... I would want to be able to assign a certain colour based on the object type to the headers css.


Any hints or tips or suggestions would be appreciated.


Many Thanks
:-/

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by Elmo_loves_you
0

No, you can't use variables or placeholders in CSS. Why would you even want to, though?

Using PHP, it's as simple as assigning a second class (.green for green background, .blue for blue background, etc.) and you should be covered.

0

thanks for your reply

I'm very new to php, so I automatically started trying to think of a solution in a syntax I was familiar with (sort of - I have a lot to learn)

I was thinking maybe about using javascript 'prototype' to overwrite the css style applied with a new one based on a certain type ...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.