有梯度编辑器的问题

时间:2013-12-07 14:20:47

标签: html css

我正在使用此渐变编辑器:http://www.colorzilla.com/gradient-editor/

但是,不是显示像显示的平滑背景,而是得到:http://i.imgur.com/Ktk7fR7.png

我尝试过设置background-repeat:repeat-y和x,但似乎没有帮助!

1 个答案:

答案 0 :(得分:0)

我不确定您是否需要它<img>,如果没有,您可以将它设为<div>并使用生成您在上述工具上看到的渐变的确切代码

<div style="-webkit-user-select: none; cursor: -webkit-zoom-in;background: background: #1e5799; /* Old browsers */background: -moz-linear-gradient(top, #1e5799 0%, #2989d8 50%, #207cca 63%, #7db9e8 100%); /* FF3.6+ */background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1e5799), color-stop(50%,#2989d8), color-stop(63%,#207cca), color-stop(100%,#7db9e8)); /* Chrome,Safari4+ */background: -webkit-linear-gradient(top, #1e5799 0%,#2989d8 50%,#207cca 63%,#7db9e8 100%); /* Chrome10+,Safari5.1+ */background: -o-linear-gradient(top, #1e5799 0%,#2989d8 50%,#207cca 63%,#7db9e8 100%); /* Opera 11.10+ */background: -ms-linear-gradient(top, #1e5799 0%,#2989d8 50%,#207cca 63%,#7db9e8 100%); /* IE10+ */background: linear-gradient(to bottom, #1e5799 0%,#2989d8 50%,#207cca 63%,#7db9e8 100%); /* W3C */filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e5799', endColorstr='#7db9e8',GradientType=0 ); /* IE6-9 */; /* FF3.6+ */;" width="713" height="300"></div>

而不是:

<img style="-webkit-user-select: none; cursor: -webkit-zoom-in;" src="http://i.imgur.com/Ktk7fR7.png" width="713" height="300">

具体。我不确定如何使用<img>

将渐变背景放在body-tag上以使其具有整页渐变背景的代码示例:

<html>
    <head>
        <meta name="viewport" content="width=device-width">
        <title>pcfOTC7.png (1312×602)</title>
    </head>

    <body style="position:absolute; margin: 0px;background: #1e5799; /* Old browsers */ background: -moz-linear-gradient(top, #1e5799 0%, #2989d8 50%, #207cca 63%, #7db9e8 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1e5799), color-stop(50%,#2989d8), color-stop(63%,#207cca), color-stop(100%,#7db9e8)); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(top, #1e5799 0%,#2989d8 50%,#207cca 63%,#7db9e8 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(top, #1e5799 0%,#2989d8 50%,#207cca 63%,#7db9e8 100%); /* Opera 11.10+ */ background: -ms-linear-gradient(top, #1e5799 0%,#2989d8 50%,#207cca 63%,#7db9e8 100%); /* IE10+ */ background: linear-gradient(to bottom, #1e5799 0%,#2989d8 50%,#207cca 63%,#7db9e8 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e5799', endColorstr='#7db9e8',GradientType=0 ); /* IE6-9 */;">
    </body>
</html>
相关问题