定义CSS常量 [英] Defining CSS Constants

查看:516
本文介绍了定义CSS常量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在CSS声明中为颜色定义一个常量值?

我在不同的CSS元素中有很多颜色,如果我在
颜色,我必须更改所有对颜色的引用。例如:


而不是:

颜色:#306090


我想说:

定义MyShadeOfBlue =''#306090''

颜色:MyShadeOfBlue

谢谢。

Is there a way to define a constant value for a color in a CSS declaration?

I have numerous colors in different CSS elements, and if I make a change in
color, I have to change all the reference to the color. For example:

Instead of this:
color: #306090

I would like to say:
define MyShadeOfBlue = ''#306090''
color: MyShadeOfBlue
Thanks.

推荐答案

" Ted" <碲************ @ aol.com>在消息中写道

新闻:T _ ******************** @ comcast.com ......
"Ted" <Te************@aol.com> wrote in message
news:T_********************@comcast.com...
我在不同的CSS元素中有很多颜色,如果我用颜色进行更改,我必须更改所有颜色的引用。例如:

而不是:
颜色:#306090

我想说:
定义MyShadeOfBlue =''#306090''
颜色:MyShadeOfBlue
I have numerous colors in different CSS elements, and if I make a change
in color, I have to change all the reference to the color. For example:

Instead of this:
color: #306090

I would like to say:
define MyShadeOfBlue = ''#306090''
color: MyShadeOfBlue




我是用PHP做的。也就是说,我使用软件创建我的.css文件。所以我

可以写:



I do this using PHP. That is, I create my .css files using software. So I
can write:


MyShadeOfBlue ='''306090'';


echo''color:#''。
MyShadeOfBlue = ''306090'';

echo ''color: #'' .


MyShadeOfBlue


显然,这个答案超出了这个新闻组的范围,可能<你感兴趣的域外的
。但是你描述的问题是

曾经让我疯狂的问题,因为当你可以使用CSS时,CSS会更容易/>
用规则生成它而不是必须全部写出来。

所以我转而使用软件来创建它。从来没有看过

回来。


--------------------

-Dana(我的电子邮件地址中没有2个)。
MyShadeOfBlue

Obviously, this answer is outside the domain of this newsgroup, and possibly
outside the domain you''re interested in. But the problem you describe is
one that used to drive me nuts, because CSS is so much easier when you can
generate it with rules rather than having to write it all out explicitly.
So I switched over to using software to create it. And have never looked
back.

--------------------
-Dana (My e-mail address doesn''t have a 2 in it).


这篇关于定义CSS常量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆