Jur*_*buc 10 css w3c css-validator
我是CSS的新手,只是构建了一个应用程序.问题是,在验证CSS时,我收到以下错误和警告:
有人可以解释这些错误和警告的含义以及如何修复它以便CSS可以被验证吗?
尽管存在这些错误,我的应用程序仍能正
这是我的CSS代码:
/*----------------------------CSS reset------------------------------*/
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after, q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
/*-----------App wrapper-----------*/
#wrapper {
padding-left: 1em;
padding-right: 1em;
}
/*-----------App description-----------*/
h1 {
font-size: 24px;
font-family: helvetica;
font-weight: bold;
text-align: center;
padding-top: 1em;
padding-bottom: 1em;
}
p {
font-size: 16px;
font-family: helvetica;
text-align:justify;
line-height: 1.2;
}
/*-----------Select menu-----------*/
#input {
padding-top: 1em;
padding-bottom: 1em;
}
#search_button, label select {
padding: 10px 10px 10px 10px;
background: #f8f8f8;
color: #444;
border: 1px solid black;
border-radius: 0;
display: inline-block;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
cursor: pointer;
outline: none;
font-family: helvetica;
font-size: 13px;
}
#search_button, label select:-moz-focusring {
color: transparent;
text-shadow: 0 0 0 #444;
}
#search_button, label select::-ms-expand {
display: none;
}
label:before {
content: '';
right: 5px;
top: -7px;
width: 30px;
height: 33px;
background: #f8f8f8;
position: absolute;
pointer-events: none;
display: block;
}
label { position: relative; }
label:after {
content: '>';
font: 16px helvetica, monospace;
color: #444;
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
right: 2px;
top: -3px;
border-bottom: 1px solid #aaa;
position: absolute;
pointer-events: none;
width: 35px;
padding: 0 0 5px 0;
text-indent: 14px;
}
/*-----------Crest, Name-----------*/
#output {
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
display: -ms-flexbox; /* TWEENER - IE 10 */
display: -webkit-flex; /* NEW - Chrome */
display:flex;
max-height: 70px;
}
#crest {
max-height: 70px;
max-width: 70px;
}
img {
max-height: 100%;
float: left;
}
#team-name {
width: 100%;
}
h2 {
font-size: 17px;
font-family: helvetica;
font-weight: bold;
text-align: center;
vertical-align: middle;
line-height: 70px;
}
/*-----------Geochart container-----------*/
/*-----------Pie chart container-----------*/
#pie-container {
display: block;
}
/*----------------------------Tablet responsive----------------------------*/
@media all and (min-width: 700px) {
/*-----------App decription-----------*/
h1 {
font-size: 50px;
}
p {
font-size: 16px;
}
/*-----------Crest, Name-----------*/
#output {
max-height: 120px;
}
#crest {
max-height: 120px;
max-width: 120px;
}
h2 {
font-size: 38px;
line-height: 120px;
}
}
/*----------------------------Desktop responsive----------------------------*/
@media all and (min-width: 900px) {
/*-----------App wrapper-----------*/
#wrapper {
padding-left: 5em;
padding-right: 5em;
}
/*-----------App decription-----------*/
h1 {
font-size: 60px;
}
p {
font-size: 18px;
}
/*-----------Crest, Name-----------*/
#output {
max-height: 160px;
}
#crest {
max-height: 160px;
max-width: 160px;
}
h2 {
font-size: 40px;
line-height: 160px;
}
/*-----------Pie chart container-----------*/
#pie-container {
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
display: -ms-flexbox; /* TWEENER - IE 10 */
display: -webkit-flex; /* NEW - Chrome */
display:flex;
}
#countryPie {
flex: 1;
}
#playerPie {
flex: 1;
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助!
Mic*_*l_B 15
TL; DR:更多关注caniuse.com中的数据,它告诉您浏览器实际在做什么,而不是W3C验证器,它需要属性和值才能在被包含之前达到高官方状态.您经常会发现太新或未开发的属性和值以包含在验证器中,但仍然受到主流浏览器的支持.
来自CSS工作组档案:
我刚用css验证器检查了我的页面redseen.3owl.com.
我收到了这个错误:
属性指针事件不存在:none
为什么这显示为错误?
因为当前没有CSS规范定义指针事件属性.它在SVG 1.1中定义,但在CSS中对非SVG元素使用指针事件是实验性的.该功能曾经是CSS3 UI草案规范的一部分,但由于许多未解决的问题,已被推迟到CSS4.
W3C CSS验证器通常在CSS3模式下检查模糊的文档集合,包括CSS 2.1和选定的"CSS3规范",不包括许多仍处于工作草案级别的文档 - 并且指针事件当前未定义WD级别(甚至在编辑的草稿中,据我所知).
http://lists.w3.org/Archives/Public/www-validator-css/2012Nov/0033.html
上面的摘录是从2012年开始的.但它在2017年仍然有效.
[本
pointer-events]扩展HTML元素,虽然存在于CSS基本用户界面模块级别3的早期草稿,一直推到它的第4级.
CSS appearance属性似乎处于相同的情况(MDN).它目前处于Editor's Draft状态,因此不包含在CSS Validator中.
在我开发的所有网站中,验证HTML比使用CSS更容易.事实上,虽然大多数时候我可以实现完整的HTML验证,但我认为我没有实现完整的CSS验证.
这是因为我使用大多数浏览器支持的属性,但在标准化过程中并不总是处于验证器阈值状态.
因此,除了一般信息之外,我不会使用CSS验证器.我建议你不要让CSS验证错误阻止你前进.
更多关注caniuse.com网站,检查浏览器对CSS属性的支持.您会发现该pointer-events属性尽管不属于当前的CSS规范,但已经被大多数主流浏览器支持了一段时间.