What's the point of valid CSS/HTML?

前端 未结 17 1935
梦如初夏
梦如初夏 2020-11-30 06:40

If I\'ve tested my pages in most major browsers, why would I need to maintain a validated code? I want to use box-shadows and corner radius if they\'re supported in WebKit b

17条回答
  •  渐次进展
    2020-11-30 07:10

    There are sometimes css or html attributes that are marked 'invalid' by some validators, but you shouldn't worry about this. Using box-shadows and rounded corners is no problem at all. Browsers that do not recognize them will simply ignore them, so no trouble there. I'd even encourage you to use those - if too many people would wait using those until they're widely supported, the web's momentum would become much too large.

    However, there is a reason for having a valid HTML structure in your document. It isn't hard at all, and it'll save you encounters with inconsistencies in wrongfully-shaped-document-handling across browsers.

    I never really understood why we are actually allowed to write structurally invalid HTML. Document readers will most likely barf out PDFs that aren't well-formed, but HTML 5 even seems to have a formal specification for error handling...

提交回复
热议问题