简体   繁体   English

IE 11中无法使用“背景图像”样式

[英]“background-image” style doesn't work in IE 11

I am trying to display the "background-image" in textarea. 我正在尝试在textarea中显示“背景图像”。 It works on my local machine on IIS. 它可以在IIS的本地计算机上运行。 I moved the code to Production running on Apache. 我将代码移至在Apache上运行的Production。 It doesn't display the image. 它不显示图像。 I tried to remove single quotes with url(asterisk.png) but still doesn't work. 我试图用url(asterisk.png)删除单引号,但仍然无法正常工作。 Please let me know if there are any suggestions. 如果有任何建议,请告诉我。

        <textarea id="test1" name="test1" class="required"  rows="25" cols="30" ></textarea> 

CSS CSS

.required {
    background-image: url('asterisk.png');
    background-position:right center;               
    background-repeat:no-repeat;
}   

在此处输入图片说明

Your code is actually working. 您的代码实际上正在工作。 Maybe you are missing the image path. 也许您缺少图像路径。

You can see a working code here: https://embed.plnkr.co/9u6s8wvWwbQYyoj3yXQ6/ 您可以在这里看到有效的代码: https : //embed.plnkr.co/9u6s8wvWwbQYyoj3yXQ6/

Is your image at the same path that your html code? 您的图片与html代码位于同一路径吗?

try it 试试吧

 .required { background-image: url(https://cdn4.iconfinder.com/data/icons/political-signs/512/red-star-communism-label-128.png); background-position:right center; background-repeat:no-repeat; } 
 <textarea id="test1" name="test1" class="required" rows="25" cols="30" ></textarea> 

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

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