Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

W3C validator, CSS3 and Bootstrap

I have a site that uses the Twitter Bootstrap framework which renders without errors in all browsers. However, when I plug the main URL of our site into the W3C validator it spits out 1,465 errors, most of which are parsing errors.

A few examples:

Parse Error {*zoom:1; Value Error : background-color Too many values or values are not recognized : #3f6998 \000009

I understand the * and \000009 are IE specific, so it is important that these are failing validation?

Is there a validator that takes these into consideration?

like image 202
bersude2 Avatar asked Jan 16 '14 15:01

bersude2


People also ask

What is the W3C validator used for?

The Markup Validator is a free service by W3C that helps check the validity of Web documents. Most Web documents are written using markup languages, such as HTML or XHTML . These languages are defined by technical specifications, which usually include a machine-readable formal grammar (and vocabulary).

How do you validate W3C standards?

The best way to validate your code is by using the W3C validation tools. CSS Validator: This validator checks the CSS validity of web documents in HTML, XHTML etc. There are plenty of browser extensions that will test the page you're viewing against the W3C validators.

Is there a CSS validator?

The W3C CSS Validation Service can be used to check the correctness (validity) of W3. CSS. The Validation Service was created by the W3C to help Web developers validate CSS.


2 Answers

You will always get css validation error while using CSS3. Most of the styles(css3) are not valid under w3 rules as of now.. You can simply ignore these errors and move ahead.. Just make sure you do not have any other validation issues other than those with css3 styles. If so you are perfectly fine..

Update :

You can try something like this :

http://jigsaw.w3.org/css-validator/validator?profile=css3&uri=PATH_TO_YOUR_WEBSITE

For eg :

http://jigsaw.w3.org/css-validator/validator?profile=css3&uri=http://stackoverflow.com

Still it will show lot of errors. There are no CSS3 validators yet implemented which is accepted.

[Updated]

URL : https://validator.w3.org/

Please use the official validator.

like image 128
Roy M J Avatar answered Nov 15 '22 01:11

Roy M J


Here is Bootstrap’s explanation for their validation errors:

https://getbootstrap.com/docs/getting-started/#support-validators

In order to provide the best possible experience to old and buggy browsers, Bootstrap uses CSS browser hacks in several places to target special CSS to certain browser versions in order to work around bugs in the browsers themselves. These hacks understandably cause CSS validators to complain that they are invalid. In a couple places, we also use bleeding-edge CSS features that aren't yet fully standardized, but these are used purely for progressive enhancement. These validation warnings don't matter in practice since the non-hacky portion of our CSS does fully validate and the hacky portions don't interfere with the proper functioning of the non-hacky portion, hence why we deliberately ignore these particular warnings.

like image 40
Mike W Avatar answered Nov 15 '22 01:11

Mike W