开发者

gradient background not working in Chrome with -webkit-gradient

Greetings all,

I'm using a gradient background with -webkit-gradient. It's not working on Chrome 8.0.552.224 on Windows 7, but I could swear it was recently working on Chrome-OS X. It's Monday so perhaps I'm missing something obvious, but if so I can't figure it out. I'd appreciate your taking a look. The sample code here will work on Firefox but doesn't display a gradient in Chrome:

Thanks, -Northk

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Gradient test </title>
    <style>
        .main-header
        {
            padding-top: 50px;
            min-height: 50px;
            background: -webkit-gradient(linear, 0%, 0%, 0%, 100%, from(#fff), to(#000));
            background: -moz-linear-gradient(top, #fff, #000);
        开发者_StackOverflow社区    border: 1px solid #000;
        }
    </style>
</head>
<body>
    <div class="main-header">
        THIS WORKS ON FIREFOX BUT DOESN'T WORK ON CHROME-WINDOWS 7!
    </div>
</body>
</html>


Seems I just got the syntax wrong. Here's how it should be:

   background: -webkit-gradient(linear, center top, center bottom, from(#fff), to(#000));   


Be aware in Chrome 16.0.912.75m still has a small CSS bug/issue when parsing style:

background:-webkit-linear-gradient  (top,gray 0,#A0A0A0 100%);

This will not work, because of spaces between -webkit-linear-gradient and start bracket. Deleting additional spaces will solve the issue as well as minifying CSSs.


Try this

background: -webkit-linear-gradient(#DDDDDD, #ffffff);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜