最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】搞清楚css中颜色值#xxx形式的#edc是什么含义

Docbook crifan 2289浏览 0评论

【背景】

折腾:

【记录】docbook中手动将css转换为fo即pdf的xsl参数配置

期间,对于之前在css中设置的背景色:

pre.screen {
/*	white-space: pre; */
	font-family: monospace;
	padding: 1ex;
	background-color: #edc;
	border: 1px solid #ccc;
	border-radius: 6px;
	line-height: 1.1;
}

pre.programlisting {
/*	white-space: pre; */
	font-family: monospace;
	padding: 1ex;
	background-color: #eee;
	border: 1px solid #ccc;
	border-radius: 6px;
	line-height: 1.1;
}

然后想要去集成到fo中,但是对于xsl中去设置:

    <xsl:attribute name="background-color">
        <xsl:choose>
            <xsl:when test="d:programlisting">>#eee</xsl:when>
            <xsl:when test="d:screen">>#edc</xsl:when>
            <xsl:otherwise>#fefde6</xsl:otherwise>
        </xsl:choose>
    </xsl:attribute>

结果会出错,说是无法解析:

#eee

所以,需要去搞懂:

css中的:

#xxx

到底是什么含义。

【折腾过程】

1.其实,对于css中的颜色值,之前已经知道有:

rgb(x,y,z)

#xxxxxx

的类型的。

但是没见过:

#xxx的类型的。

2.去参考:

http://www.w3schools.com/html/html_colornames.asp

http://www.w3school.com.cn/cssref/css_colornames.asp

http://www.w3school.com.cn/cssref/css_colorsfull.asp

http://web.njit.edu/~kevin/rgb.txt.html

都是没有解释的清楚:

#xxx

的含义。

3.后来的后来,终于是参考:

CSS颜色值转换

知道了,原来是:

#edc=#eeddcc

然后就解决了此处的问题了。

4.但是,需要说明的是,

其实:

是自己不小心,颜色值之前,多写了个大于号:

            <xsl:when test="d:programlisting">>#eee</xsl:when>
            <xsl:when test="d:screen">>#edc</xsl:when>

实际该是:

            <xsl:when test="d:programlisting">#eee</xsl:when>
            <xsl:when test="d:screen">#edc</xsl:when>

而这样的#xxx的颜色值,在xsl中,也是可以被正确识别的。

 

【总结】

由于自己的不小心,以为xsl中不识别#xxx的颜色值呢,实际上是可以的。

但是,也是算是让自己花精力去搞清楚

#xyz==#xxyyzz

的含义了。

转载请注明:在路上 » 【已解决】搞清楚css中颜色值#xxx形式的#edc是什么含义

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.183 seconds, using 22.10MB memory