简体   繁体   English

IE9-占位符和背景图像与渐变结合使用的问题

[英]IE9 - problem with placeholder and background-image in combination with gradient

I have a text input field in HTML and the attribute placeholder : 我在HTML和属性placeholder有一个文本输入字段:

<input type="text" placeholder="Filter results...">

Unfortunately, the placeholder attribute seems not to work? 不幸的是, placeholder属性似乎不起作用? I thought it is implemented in Internet Explorer 9? 我以为它是在Internet Explorer 9中实现的? You can see the demo here: http://jsbin.com/esiya3/5/ - http://jsbin.com/esiya3/5/edit 您可以在此处查看演示: http : //jsbin.com/esiya3/5/-http : //jsbin.com/esiya3/5/edit

Also I have a problem with -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#ffffff', EndColorStr='#f0f0f0')"; 我也有-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#ffffff', EndColorStr='#f0f0f0')";的问题-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#ffffff', EndColorStr='#f0f0f0')"; in combination with a background-image . 结合background-image In all other browsers, Firefox, Opera, Safari, Chrome, the gradient and the background-image is displayed. 在所有其他浏览器中,将显示Firefox,Opera,Safari,Chrome,渐变和背景图像。 Only in IE 9 the background-image is not there. 仅在IE 9中,背景图像不存在。 I have to exclude the gradient, then I can see the image. 我必须排除渐变,然后才能看到图像。 But what can I do to have both? 但是,我要怎么做都可以呢?

Here is the demo with the gradient: http://jsbin.com/esiya3/5/ - http://jsbin.com/esiya3/5/edit 这是带有渐变的演示: http : //jsbin.com/esiya3/5/-http : //jsbin.com/esiya3/5/edit

and without the gradient: http://jsbin.com/esiya3/6/ - http://jsbin.com/esiya3/6/edit 并且没有渐变: http : //jsbin.com/esiya3/6/-http : //jsbin.com/esiya3/6/edit

Perhaps someone have an idea? 也许有人有主意?

Thank you in advance & Best Regards. 预先感谢您和最诚挚的问候。

You could combine a gradient filter with an alpa image loader: 您可以将渐变滤镜与Alpa图像加载器结合使用:

filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='myimage.png')
    progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f0f0f0');

to solve the gradient-picture problem. 解决渐变图片问题。

you can use svg for background-image. 您可以将svg用于背景图像。 you should with svg tag create your gradiant & save it with etension .svg , then load it in css file. 您应该使用svg标签创建渐变并使用etension .svg保存它,然后将其加载到CSS文件中。

<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
  <linearGradient id="g">
<stop offset="0" stop-color="blue" />
<stop offset="0.3" stop-color="yellow" />
<stop offset="0.6" stop-color="orange" />
<stop offset="1" stop-color="red" />
  </linearGradient>
  <rect x="0" y="0" width="100%" height="100%" fill="url(#g)" />
</svg>

css file CSS文件

div{background-image: url(gradient.svg);}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM