我希望使用PIE.htc
为我的选择设置圆角,并希望在IE8
中为我的选择设置渐变,但渐变仅出现在选择而非指针上。
指针是通过伪元素:after
创建的,但它没有显示,而是显示选择的默认指针。我究竟做错了什么?。
如您所见,我在select
和.myselect:before
使用渐变。
HTML
<label class="myselect">
<select class="date">
<option value="y">Show Year</option>
<option value="m" selected="selected">Show Month</option>
</select>
</label>
CSS
select {
height: 30px;
border: 1px solid black;
width: auto !important;
padding: 3px;
margin: 0;
line-height: 30px;
}
.myselect {
position: relative;
display: inline-block;
}
select, .myselect:before {
background: #ffffff;
/* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;
base64, PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNlZWVlZWUiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, #ffffff 0%, #eeeeee 100%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffffff), color-stop(100%, #eeeeee));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%, #eeeeee 100%);
/* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%, #eeeeee 100%);
/* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%, #eeeeee 100%);
/* IE10+ */
background: linear-gradient(to bottom, #ffffff 0%, #eeeeee 100%);
/* W3C */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);
/* IE6-8 */
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
}
.myselect:before {
content:"";
height: 41px;
right: 2px;
top: 2px;
width: 21px;
display: block;
position: absolute;
}
.myselect:after {
top: 20px;
content:'';
right: 8px;
position: absolute;
pointer-events: none;
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 5px solid black;
}
/*and in my explorer 8 stylesheet i have*/
select {
position: relative;
z-index: 1;
filter: none !important;
background: #FFFFFF;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#FFFFFF), to(#EEEEEE));
background: -webkit-linear-gradient(#FFFFFF, #EEEEEE);
background: -moz-linear-gradient(#FFFFFF, #EEEEEE);
background: -ms-linear-gradient(#FFFFFF, #EEEEEE);
background: -o-linear-gradient(#FFFFFF, #EEEEEE);
background: linear-gradient(#FFFFFF, #EEEEEE);
-pie-background: linear-gradient(#FFFFFF, #EEEEEE);
behavior: url("/css/PIE.htc");
}
.myselect:before {
background: #FFFFFF;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#FFFFFF), to(#EEEEEE));
background: -webkit-linear-gradient(#FFFFFF, #EEEEEE);
background: -moz-linear-gradient(#FFFFFF, #EEEEEE);
background: -ms-linear-gradient(#FFFFFF, #EEEEEE);
background: -o-linear-gradient(#FFFFFF, #EEEEEE);
background: linear-gradient(#FFFFFF, #EEEEEE);
-pie-background: linear-gradient(#FFFFFF, #EEEEEE);
behavior: url("/css/PIE.htc");
}