Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgba()/hsl()/hsla() on CSSLint v0.8.1 #206

Closed
hail2u opened this issue Oct 27, 2011 · 3 comments
Closed

rgba()/hsl()/hsla() on CSSLint v0.8.1 #206

hail2u opened this issue Oct 27, 2011 · 3 comments
Milestone

Comments

@hail2u
Copy link

hail2u commented Oct 27, 2011

Using rgba()/hsl()/hsla() in CSS code, CSSLint v0.8.1 warns like this:

Expected color or one of (inherit) but found 'rgba(0 , 0 , 0 , 0.5)'.

Tested on csslint.net with following code:

.rgb {
  color: rgb(0, 0, 0);
}

.rgba {
  color: rgba(0, 0, 0, 0.5);
}

.hsl {
  color: hsl(0, 0%, 0%);
}

.hsla {
  color: hsla(0, 0%, 0%, 0.5);
}
@dmcass
Copy link

dmcass commented Oct 27, 2011

In addition to adding support for these color functions, this should be followed up with a new rule since these color functions aren't supported by all browsers.

Name: CSS3 Colors
Rule: When using CSS3 colors, a fallback color should be provided for browsers which don't support them.
Affected Browsers: IE6, IE7, IE8
Source: http://caniuse.com/#css3-colors

Failing example:

.rgba {
  color: rgba(0, 0, 0, 0.5);
}
.hsl {
  color: hsl(0, 0%, 0%);
}
.hsla {
  color: hsla(0, 0%, 0%, 0.5);
}

Passing example:

.rgba {
  /* Fallback with RGB */
  color: rgb(0, 0, 0);
  color: rgba(0, 0, 0, 0.5);
}
.hsl {
  /* Fallback with hex */
  color: #000;
  color: hsl(0, 0%, 0%);
}
.hsla {
  /* Fallback with constant */
  color: black;
  color: hsla(0, 0%, 0%, 0.5);
}

@nzakas
Copy link
Contributor

nzakas commented Oct 28, 2011

@hail2u - Thanks, definitely seems like the parser is missing those as valid colors.

@dmcass - Can you please open a separate issue for that? We can only track one thing per issue. Thanks.

@stubbornella
Copy link
Member

This is a great rule. +1

@nzakas nzakas closed this as completed in 8e1a35d Nov 15, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants