标签云

微信群

扫码加入我们

WeChat QR Code

BgColor属性是如何计算的?[重复]

Possible Duplicate:
Why does HTML think “chucknorris” is a color?

How is the bgcolor property calculated?

When i use the following html code...

<body bgcolor="#Deine Mutter hat eine Farbe und die ist grün."></body>

...what I get is the following color.

#Deine Mutter hat eine Farbe und die ist grün.

By the way: When I try to use it in CSS it won´t work and will apply the standard color:

body{
    color: #IchwillGOLD;
}

Why?


Well obviously that sentence translates to green in english!

2018年05月23日04分08秒

Here's an interesting revelation (or coincidence)... <body bgcolor="#der hintergrund ist gold"> produces a gold color (#DEE000 to be exact). Looking at the string of text (der hintergrund ist gold), if you remove all non-hex characters, you get: dee. Fill in the remaining chars with zeros, and you get the hex color (#DEE000)

2018年05月23日04分08秒

The trouble is, I don't see a way of making OP's original text string into the appropriate green hex.

2018年05月23日04分08秒

Hannes sadly you are right... coincidence only... the mystery continues!

2018年05月24日04分08秒

There has to be a kind of algorithm which calculates a proper hex-rgb value

2018年05月24日04分08秒

Trial and error did seem to highlight the point of breaking into 3 parts for me...

2018年05月23日04分08秒

Ioxxy: I got 1 through trial and error and I was on my way to 2 (I was able to delete 2 zeroes but not three from the end of the string) when I decided to just look it up.

2018年05月24日04分08秒

Well, Besides that, the very first step would be to match against keywords red, blue.. etc

2018年05月23日04分08秒

sharethis Because this is was made to make existing websites from back in the day when standards weren't adhered to by browsers be rendered correctly. CSS was invented in the days of standards, so it never suffered such abuse.

2018年05月24日04分08秒

In addition, these presentational attributes are eventually translated to their corresponding CSS rules with zero author-level specificity, as per w3.org/TR/CSS21/cascade.html#preshint This is why WebKit, for example, passes the resulting color value to a CssColor struct.

2018年05月23日04分08秒

Only for clarification, Soluter should accept your answer.

2018年05月24日04分08秒

I didn't mean to quarrel about points or anything. Just remarking that it wasn't any different. But it is in fact a (possibly) useful clarification, so I removed the comment.

2018年05月23日04分08秒