Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

css - 8-digit hex is not a background-color value

I am using the W3 CSS validator and when trying to validate my code it finds these errors:

121 thead Value Error : background-color #e422357a is not a background-color value : #e422357a 125 tbody Value Error : background-color #1515157a is not a background-color value : #1515157a 129 tfoot Value Error : background-color #e8b63d7a is not a background-color value : #e8b63d7a

This is the code in question. This is for a school assignment and my professor told me it's important that I validate my code, but I can't seem to figure out what is wrong with it?

Aren't 8 digit hex colors valid background colors?

thead {
    background-color: #e422357a;
}

tbody {
    background-color: #1515157a;
}

tfoot {
    background-color: #e8b63d7a;
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The Jigsaw W3C CSS validator isn't known for being up to date with developing standards, such as most level 4 CSS features. New features are being introduced and implemented faster than they can be standardized or validators can catch up, so validation has become increasingly unreliable as anything other than a sanity check for potential careless mistakes, rather than traditional standards-compliance "certification" (if you will).

As long as you use the notation with the understanding that browser support isn't complete and these drafts are subject to change (although support for this notation is extremely unlikely to change), you'll be fine.

If you are concerned about validation, your best bet is to rewrite these values to their rgba() counterparts, which enjoy cross-browser support and are recognized by Jigsaw.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...