建议:继承 [英] Suggestion: Inheritance

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

问题描述




当我正在为整个网络应用程序编写样式表时我错过了一个

CSS功能能够引用其他元素的CSS属性。

假设有一个背景/前景色组合:


BasicStyles.css:

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

身体

{

背景色:白色;

颜色:红色;

}

我建议为CSS添加一个功能,以便能够在
中引用这些值
另一个样式表,例如能够反转基本颜色而不需要实际需要*知道*明确的颜色值。例如:


ParticularStyles.css:

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

。强调

{

背景颜色:红色;

颜色:白色;

}

应该是这样的:


ParticularStyles.css:

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

。强调

{

background-color:body.color; - 使用身体的计算颜色

元素

颜色:inherited.background-color;使用计算继承

背景颜色

}

Axel Dahmen

解决方案

在< d5 ********** @ online.de> ;, Axel Dahmen写道:

当我在整个Web应用程序的编程样式表我错过了一个CSS功能,可以引用其他元素的CSS属性。

我建议添加一个功能给CSS能够在另一个样式表中引用这些值,例如能够反转基本颜色而不需要*知道*明确的颜色值。例如:




@import" BasicStyles.css" ;;在ParticularStyles.css?


-

|":._。:" | http://habett.com/

| (=)| http://habett.org/

| \。 | ./ | http://www.roux.to/

< br>

Axel Dahmen写道:

当我正在为整个Web应用程序编写样式表时我错过了一个CSS功能,可以引用CSS属性其他元素。




是的,我经常希望有类似的东西。这个话题之前已经提出过了,但是在没有对CSS进行任何更改以及对浏览器进行更改的同时,建议只使用

服务器端代码或预处理器,用于生成所需的CSS,并在代码或预处理器中内置

智能。


然后让我们开始分数来建议这种功能。 CSS3正在开发中,因此现在是时候提出修改建议了。


我认为这是必要的功能。特别是如果你想要
在几个样式表中提供一个同质的设计。


一个典型的应用程序是让客户选择更改基本

样式(如正文背景颜色)并自动获取详细信息

元素相应匹配(如给定示例中所示)。


RFC

Axel Dahmen


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

" CA Upsdel​​l" <"" cupsdel​​lXXX\" @ - @ - @ XXXupsdel​​l.com"> schrieb im Newsbeitrag

新闻:_d ******************** @ rogers.com ...

Axel Dahmen写道:

当我正在为整个Web应用程序编写样式表时我错了一个CSS功能,以便能够引用其他元素的CSS属性。


是的,我经常希望有类似的东西。之前已经提出过这个主题,但是在没有对CSS进行任何更改以及对浏览器进行相应更改的情况下,简单地建议使用服务器端代码或预处理器使用内置于代码或预处理器中的
智能来生成所需的CSS。



Hi,

when I''m programming style sheets for a whole web application I''m missing a
CSS feature to be able to reference CSS properties of other elements.
Let''s say there is a background/foreground colour combination of:

BasicStyles.css:
----------------
body
{
background-color: white;
color: red;
}
I suggest to add a feature to CSS be able to reference these values in
another style sheet, e.g. to be able to invert the basic colours without
actually being required to *know* the explicit colour values. For instance:

ParticularStyles.css:
----------------
.emphasize
{
background-color: red;
color: white;
}
should become something like:

ParticularStyles.css:
----------------
.emphasize
{
background-color: body.color; -- using the computed colour of the body
element
color: inherited.background-color; using the computed inherited
background-colour
}
Axel Dahmen

解决方案

In <d5**********@online.de>, Axel Dahmen wrote:

when I''m programming style sheets for a whole web application I''m missing a
CSS feature to be able to reference CSS properties of other elements.

I suggest to add a feature to CSS be able to reference these values in
another style sheet, e.g. to be able to invert the basic colours without
actually being required to *know* the explicit colour values. For instance:



What wrong with @import "BasicStyles.css"; in ParticularStyles.css ?

--
|":._.:"| http://habett.com/
| (=) | http://habett.org/
|\. | ./| http://www.roux.to/


Axel Dahmen wrote:

when I''m programming style sheets for a whole web application I''m missing a
CSS feature to be able to reference CSS properties of other elements.



Yeah, I''ve often wished for something similar. This topic has been
raised before, but in the absence of any changes to CSS and concommitant
changes to the browsers, the suggestion has simply been made to use
server-side code or a preprocessor to generate the desired CSS, with the
smarts built into the code or preprocessor.


Then let''s start a fraction to suggest this kind of functionality. CSS3 is
under development, so it''s the right time to suggest amendments.

I believe this to be a necessary feature. Particularly if you want to
provide a homogeneous design throughout several style sheets.

One typical application would be giving customers the option to change basic
styles (like body background-color) and to automatically have detail
elements match accordingly (like in the given example).

RFC
Axel Dahmen

--------------
"C A Upsdell" <""cupsdellXXX\"@-@-@XXXupsdell.com"> schrieb im Newsbeitrag
news:_d********************@rogers.com...

Axel Dahmen wrote:

when I''m programming style sheets for a whole web application I''m missing a CSS feature to be able to reference CSS properties of other elements.



Yeah, I''ve often wished for something similar. This topic has been
raised before, but in the absence of any changes to CSS and concommitant
changes to the browsers, the suggestion has simply been made to use
server-side code or a preprocessor to generate the desired CSS, with the
smarts built into the code or preprocessor.



这篇关于建议:继承的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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