要在IE8中实现border-radius,我使用 border-radius.htc
正确工作的块realzovat border-radius:
.mc-button
{
-moz-transition: all 0.218s ease 0s;
-moz-user-select: none;
background-color: #CBCBCB;
background-image: -moz-linear-gradient(center top , #CBCBCB, #DCDCDC);
border: 1px solid #DCDCDC;
color: #FFFFFF;
cursor: default;
display: inline-block;
font-size: 11px;
font-weight: bold;
height: 29px;
line-height: 29px;
min-width: 70px;
padding: 0 8px !important;
text-align: center;
overflow: visible;
font-family: inherit;
font-size: inherit;
float: left;
text-decoration: none;
display: block;
-webkit-border-radius: 5px;
-khtml-border-radius: 5px;
-moz-outline-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
font-family: Arial, Sans-Serif !important;
behavior:url(Content/border-radius.htc);
}
根据附件列表 - border-radius.htc 连接到页面
请告诉我如何解决问题?
更新(06/13/2012)
如果代码被按钮替换:
.mc-button
{
border: 1px solid #696;
height: 29px;
line-height: 29px;
min-width: 70px;
text-align: center;
padding: 0 8px !important;
overflow: visible;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
float: left;
display: block;
background: #00ADEE;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#00ADEE), to(#0078A5));
background: -webkit-linear-gradient(#00ADEE, #0078A5);
background: -moz-linear-gradient(#00ADEE, #0078A5);
background: -ms-linear-gradient(#00ADEE, #0078A5);
background: -o-linear-gradient(#00ADEE, #0078A5);
background: linear-gradient(#00ADEE, #0078A5);
-pie-background: linear-gradient(#00ADEE, #0078A5);
behavior: url("Content/PIE.htc");
}
并声明为:
<a id="login_button" class="mc-button mc-button-submit ">SomeText</a>
.mc-button-submit
{
border: 0px solid #0076A3;
background: #00ADEE;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#00ADEE), to(#0078A5));
background: -webkit-linear-gradient(#00ADEE, #0078A5);
background: -moz-linear-gradient(#00ADEE, #0078A5);
background: -ms-linear-gradient(#00ADEE, #0078A5);
background: -o-linear-gradient(#00ADEE, #0078A5);
background: linear-gradient(#00ADEE, #0078A5);
-pie-background: linear-gradient(#00ADEE, #0078A5);
color: #FFFFFF;
text-align: center;
}
圆形它消失了。添加 .mc-button-submit 行行为:url(“Content / PIE.htc”); 无效。
你能告诉我如何用背景参数连接第二类吗?
答案 0 :(得分:3)
独立 .htc 黑客不能同时用于后台gradient
和border-radius
。
尝试用简单的图片替换css gradient
。这个技巧会起作用。
你也可以使用css3pie(感谢@ dop-trois) - 这个纯粹的Javascript工具比独立的.htc
文件更完美。
PS。在两个解决方案中都无法实现插入box-shadow
。
PPS:您需要的代码在这里:(我更改了一下以使其更有效和正确):
.mc-button {
font: bold 11px/29px Arial, Helvetica, sans-serif !important;
text-align: center;
text-decoration: none;
color: #FFFFFF;
border: 1px solid #DCDCDC;
height: 29px;
min-width: 70px;
padding: 0 8px !important;
overflow: visible;
display: block;
float: left;
/* Unique link for this gradient — http://www.colorzilla.com/gradient-editor/#cbcbcb+0,dcdcdc+100;Custom */
background-color: #CBCBCB;
background: -moz-linear-gradient(top, rgba(203,203,203,1) 0%, rgba(220,220,220,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(203,203,203,1)), color-stop(100%,rgba(220,220,220,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(203,203,203,1) 0%,rgba(220,220,220,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(203,203,203,1) 0%,rgba(220,220,220,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(203,203,203,1) 0%,rgba(220,220,220,1) 100%); /* IE10+ */
background: linear-gradient(top, rgba(203,203,203,1) 0%,rgba(220,220,220,1) 100%); /* W3C */
/* css3 stuff below: (via css3please.com) */
/* no one prefix except `-webkit` is needed nowadays for `border-radius` */
-webkit-border-radius: 5px;
border-radius: 5px;
-webkit-transition: all 0.218s ease-out;
-moz-transition: all 0.218s ease-out;
-ms-transition: all 0.218s ease-out;
-o-transition: all 0.218s ease-out;
transition: all 0.218s ease-out;
/* PIE specific accordingly http://css3pie.com/documentation/q-and-a/ */
behavior: url(PIE.htc);
}
PIE.htc
(重要!)根据答案,可能的问题可能是mime类型(“text / x-component”)。
也可能的解决方案是:
position: relative;
z-index: 0;
答案 1 :(得分:2)
要应用渐变和边界半径,我建议 CSS3 Pie 。这是最强大的工具我知道,在IE中应用CSS3属性。
#myElement {
background: #CCC; /*fallback for non-CSS3 browsers*/
background: -webkit-gradient(linear, 0 0, 0 100%, from(#CCC) to(#EEE)); /*old webkit*/
background: -webkit-linear-gradient(#CCC, #EEE); /*new webkit*/
background: -moz-linear-gradient(#CCC, #EEE); /*gecko*/
background: -ms-linear-gradient(#CCC, #EEE); /*IE10*/
background: -o-linear-gradient(#CCC, #EEE); /*opera 11.10+*/
background: linear-gradient(#CCC, #EEE); /*future CSS3 browsers*/
-pie-background: linear-gradient(#CCC, #EEE); /*PIE*/
behavior: url(PIE.htc);
}
#myAwesomeElement {
border: 1px solid #999;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
behavior: url(path/to/PIE.htc);
}
你需要PHP才能让它发挥作用。
CSS3 Pie网站上的顺便说一句:应用border-radius&amp;使用此工具可以在同一时间进行渐变;)
希望这会有所帮助:)
答案 2 :(得分:0)
要应用渐变,框阴影和边框半径,我建议使用CSS3 Pie。我在cook&amp; smile项目中使用它,它在IE中完全有效。
*{ behavior:url(path/PIE.htc);}
.border_radius_div{ position:relative; -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px;}
.gradient_div{ position:relative;
background: #EEFF99;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#EEFF99), to(#66EE33));
background: -webkit-linear-gradient(#EEFF99, #66EE33);
background: -moz-linear-gradient(#EEFF99, #66EE33);
background: -ms-linear-gradient(#EEFF99, #66EE33);
background: -o-linear-gradient(#EEFF99, #66EE33);
background: linear-gradient(#EEFF99, #66EE33);
-pie-background: linear-gradient(#EEFF99, #66EE33); }
访问此网站以进一步探索自己。
注意:
不要忘记使用我们使用边框半径,渐变和方框阴影的位置(相对或绝对)。
不要忘记使用behavior:url(xhtml_folder/PIE.htc);