1

你可以在这里看到我的整个 HTML。您可以将其复制/粘贴到本地的演示文档中,然后查看我所指的内容。

http://chopapp.com/#ny9fxmtv

基本上,我想将框设置为在右侧同时具有渐变和自定义箭头。如上图所示。

问题是我得到的渐变是通过这个代码:

background: -webkit-gradient(linear, left top, left bottom, from(#f8f8f8), to(#ececec)) ;

这是我上面代码中的第 21 行。但是因为“背景”属性已经被这一行占用了,我不能也包括一个“url(image.png)”标签来指定自定义的向下箭头图像,这是我的代码中的第 20 行。

有没有办法让我有渐变向下箭头的图像?

谢谢!

4

3 回答 3

2

检查此链接

background: #6cab26;
background: url(IMAGE_URL); /* fallback */
background: url(IMAGE_URL), -webkit-gradient(linear, left top, left bottom, from(#444444), to(#999999)); /* Saf4+, Chrome */
background: url(IMAGE_URL), -webkit-linear-gradient(top, #444444, #999999); /* Chrome 10+, Saf5.1+ */
background: url(IMAGE_URL),    -moz-linear-gradient(top, #444444, #999999); /* FF3.6+ */
background: url(IMAGE_URL),     -ms-linear-gradient(top, #444444, #999999); /* IE10 */
background: url(IMAGE_URL),      -o-linear-gradient(top, #444444, #999999); /* Opera 11.10+ */
background: url(IMAGE_URL),         linear-gradient(top, #444444, #999999); /* W3C */
于 2012-10-02T13:10:36.850 回答
1
<div class="selectParent">
 <select>
      <option value="1">Option 1</option>
      <option value="2">Option 2</option>           
 </select>  
 </div>​


.selectParent{
width:80px;
overflow:hidden;
background: #d0e4f7;
background: -moz-linear-gradient(top,  #d0e4f7 0%, #73b1e7 24%, #0a77d5 50%, #539fe1 79%, #87bcea 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#d0e4f7), color-stop(24%,#73b1e7), color-stop(50%,#0a77d5), color-stop(79%,#539fe1), color-stop(100%,#87bcea));
background: -webkit-linear-gradient(top,  #d0e4f7 0%,#73b1e7 24%,#0a77d5 50%,#539fe1 79%,#87bcea 100%);
background: -o-linear-gradient(top,  #d0e4f7 0%,#73b1e7 24%,#0a77d5 50%,#539fe1 79%,#87bcea 100%);
background: -ms-linear-gradient(top,  #d0e4f7 0%,#73b1e7 24%,#0a77d5 50%,#539fe1 79%,#87bcea 100%);
background: linear-gradient(to bottom,  #d0e4f7 0%,#73b1e7 24%,#0a77d5 50%,#539fe1 79%,#87bcea 100%);



}

.selectParent select{
width: 100px;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
padding: 2px 2px 2px 2px;
border: none;
 background: transparent url("http://cdn1.iconfinder.com/data/icons/cc_mono_icon_set/blacks/16x16/br_down.png") no-repeat 60px center;


 }

演示

于 2012-10-02T13:23:08.480 回答
0

你能在框中使用一个列表吗

ul.className {list-style-image:url('someimage.gif');} 

然后根据需要放置您的盒子背景。

第二种选择只是在该 div 的顶部放置一个 div,并有一个渐变和顶部的箭头。类似的东西?

于 2012-10-02T13:06:34.710 回答