What is the standard way to eliminate unsupported CSS expressions?

What does the CSS standard say about unsupported expressions? How should a browser deal with them? How do actual browser implementations cope with them?

I am implementing CSS property optimizer (for the minifier project), and we want to leave unused CSS backups. Our goal is to optimize the CSS as much as possible, but in such a way that it displays exactly the same as the original .
That’s why it’s important for me to understand how this works.

Simple properties

For simple properties, this is very simple.
Say we have this:

div {
    color: #f00;
    color: rgba(1,2,3,.4);
}

In this case, if the browser does not support rgba, the first ad wins #f00. There are no questions here.

Shorthands

, ?
:

div {
    background: #f00;
    background: rgba(1,2,3,.4);
}

, rgba?. , background: background: <color> <image> <repeat> <attachment> <position>;, 5 , ; , 5 . :

  • , .
  • , rgba(...) background-image, , , background-color
  • , rgba(...) a background-color , , #f00

, , :

div {
    background: #fff url(...) no-repeat;
    background: rgba(1,2,3,.4) linear-gradient(...) repeat-y;
}

CSS,...

  • rgba?
  • linear-gradient?
  • repeat-y?
  • ?
  • ?
+4
2

, , .

+2

4.2 CSS2.1 , , , , :

  • . . :

    img { float: left }       /* correct CSS 2.1 */
    img { float: left here }  /* "here" is not a value of 'float' */
    img { background: "red" } /* keywords cannot be quoted */
    img { border-width: 3 }   /* a unit must be specified for length values */
    

    CSS 2.1 , :

    img { float: left }
    img { }
    img { }
    img { }
    

    , CSS, .

, background, .

, , - , , .

, :

  • , .

: .

+4

Source: https://habr.com/ru/post/1526504/


All Articles