CSS (perhaps with Compass): Cross-browser gradient

后端 未结 3 996
梦毁少年i
梦毁少年i 2020-12-29 11:02

I would like to get a gradient in CSS (perhaps through Compass) that works in every major browser, including IE7+. Is there an easy way to do this (without writing a lot of

3条回答
  •  無奈伤痛
    2020-12-29 11:55

    While gradients are of limited complexity, they're complex enough to require what you would consider "lots of code".

    Consider:

    • starting colour, ending colour and the hexadecimal math required to transition between one and the other
    • The number of "steps"
    • The width/height of each step
    • Since there is no pure CSS way of doing this, it means rendering HTML, one element for each colour/step, without messing up your existing HTML

    So, no, without a plug-in that does all of this for you, it would require a bit of code, or an image.

提交回复
热议问题