简体   繁体   English

CSS线性渐变不适用于实时服务器(仅适用于IE),可以在localhost上正常使用

[英]CSS linear gradients not working on live server (IE only), fine on localhost

I have just rolled out a new Intranet that ive been working on for some time. 我刚刚推出了一个新的Intranet,并且已经投入了一段时间。 All is good (apart from the inevitable user-centric issues and a couple of bugs) 一切都很好(除了不可避免的以用户为中心的问题和一些错误)

However its just become apparent (now that i have a chance to actually look at the front end as opposed to hacking code to fix problems) that for some reason my css linear gradients arent working. 但是,由于某些原因,我的css线性渐变无法正常工作(它现在变得很明显了(现在,我有机会实际查看前端,而不是修改代码来解决问题))。

This is very odd to me, as when i view the same site in its test environment (localhost) the gradients work in all their glory. 这对我来说很奇怪,因为当我在其测试环境(本地主机)中查看同一站点时,渐变就可以发挥所有作用。 on the same PC, in the same browser (2 tabs open, one local, one external) 在同一台PC上,在同一浏览器中(打开2个标签,一个在本地,一个在外部)

all other css (in the same style file) works fine. 所有其他CSS(在同一样式文件中)均能正常工作。

#PageTitleBox{
position:absolute;
left:0px;
top:2px;
width:169px;
z-index:3;
padding-top:0px;
padding-bottom:10px;
padding-left:10px;
padding-right:10px;
background-color:#A9D4CC;
background-image: -webkit-linear-gradient(180deg, #A9D4CC, #7DB4B3);
background-image: -moz-linear-gradient(180deg, #A9D4CC, #7DB4B3);
background-image: -o-linear-gradient(180deg, #A9D4CC, #7DB4B3);
background-image: linear-gradient(180deg, #A9D4CC, #7DB4B3);
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=1, startColorstr='#7DB4B3', endColorstr='#A9D4CC')";
height: 55px;}

OK. 好。 I reckon you may have IE9 switched to compatibility view. 我认为您可能已将IE9切换到兼容性视图。 (http://stackoverflow.com/questions/3726357/why-does-ie9-switch-to-compatibility-mode-on-my-website). (http://stackoverflow.com/questions/3726357/why-does-ie9-switch-to-compatibility-mode-on-my-website)。

You can include <meta http-equiv="X-UA-Compatible" content="IE=Edge"/> in your HTML HEAD to instruct IE to not do this, or set the equivalent HTTP response header using the server. 您可以在HTML HEAD中包含<meta http-equiv="X-UA-Compatible" content="IE=Edge"/> ,以指示IE不要这样做,或者使用服务器设置等效的HTTP响应标头。

IE might ignore this anyway if the reason is your live server is considered to be part of your Intranet Zone by IE. 如果原因是IE将您的实时服务器视为您的Intranet区域的一部分,则IE仍可能会忽略此设置。 In which case you have to configure IE not to use Compatibility View for intranet sites, in the Compatibility View settings. 在这种情况下,必须在兼容性视图设置中将IE配置为不对Intranet站点使用兼容性视图。

您可以将渐变对象的“启用”属性设置为true。

-ms-filter: "progid:DXImageTransform.Microsoft.gradient(enabled='true', GradientType=1, startColorstr='#7DB4B3', endColorstr='#A9D4CC')";

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

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