|
使用appearance:none去除select的默认样式,配合使用gradient、background-size,background-position,拼出自定义的样式,大家可以发挥想象力做出绚丽的select
实现原理很简单: 1,使用appearance:none去除select的默认样式; 2,配合使用gradient、background-size,background-position,拼出自定义的样式 我定义的样式和浏览器默认给出的样式没多大差别,主要是简单实现一下,大家可以发挥想象力做出绚丽的select。
实现css如下:
复制代码代码如下: select{ margin: 0; padding: 0; outline: none; height: 25px; line-height: 25px; width: 120px; border: rgb(191, 204, 220) 1px solid; border-radius: 3px; display: inline-block; font: normal 12px/25px "微软雅黑", "SimSun", "宋体", "Arial"; background-size: 5px 5px,5px 5px,25px 25px,1px 25px; background-color: #fff; background-image: repeating-linear-gradient(225deg,rgb(105,123,149) 0%,rgb(105,123,149) 50%,transparent 50%,transparent 100%), repeating-linear-gradient(135deg,rgb(105,123,149) 0%,rgb(105,123,149) 50%,transparent 50%,transparent 100%), linear-gradient( #FFFFFF 0%,#F8F9Fd, #EFFAFA 100%), repeating-linear-gradient( rgb(191, 204, 220) 0%,rgb(191, 204, 220) 100%); background-repeat: no-repeat; background-position: 101px 10px,106px 10px,right top,92px top; -webkit-appearance: none }
对CSS掌握的不是很好,用的比较笨拙,还请高手指教。 http://www.smilce.com/?p=244 |
|