2 replies [Last post]
macamba
macamba's picture
Offline
Regular
Arnhem
Last seen: 13 years 42 weeks ago
Arnhem
Timezone: GMT+1
Joined: 2007-03-22
Posts: 45
Points: 0

Hi all,

I hate it to look up the codes of colors to know what color is used. So I would like to use a constant on each place a color is used. That is easy peasy:

$blue='#369';
$green='#363';
$lgreen='#cfc';

[…]

ul#navigation{
	background:$blue;
	color:#fff;
}

But now I want to use it inside my templates, which span several pages (I like to have template for each subtask in my CSS, for example one for my menu). How should I combine the two?

Put the color constants before the import statements? Can I then use the color constants in the subtemplates, because the browser will load all, and see only one big template?

$blue='#369';
$green='#363';
$lgreen='#cfc';

@import url("navigation.css");
@import url("menu.css");
@import url("header.css");

Anyone know the answer?

TIA,
Michel

Tags:
Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 31 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

Have you tried that then? to

Have you tried that then? to see if it works?

Stylesheets are processed by the browser the server just sends them by request along with the html they aren't opened and embedded as an include would be.

You're going to need to change the css files to php ones so that can process script and will need to generate headers sending the correct css mime type

Moving to 'Off Topic' not really a css question

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

roytheboy
roytheboy's picture
Offline
Guru
North Wales, UK
Last seen: 9 years 3 weeks ago
North Wales, UK
Timezone: GMT+1
Joined: 2004-09-18
Posts: 2233
Points: 41

If you don't mind a very

If you don't mind a very limited palette then you can use colour names instead of hex values e.g. color: red;

The php elements you refer to are variables, not constants. There is a big difference Wink

Life's a b*tch and then you die!