在下拉菜单CF7中添加箭头

时间:2020-09-18 12:03:15

标签: css wordpress drop-down-menu contact-form-7

我在客户的网站上使用联系表7,并且将下拉菜单的样式设置为:

.wpcf7-form select {
    -webkit-appearance: textfield;
color: #72858a;
font-size: 0.7777777778rem;
background-color: #e9edf0;
border-color: #e9edf0;
padding-top: 5px;
padding-bottom: 5px;
}

不幸的是,现在箭头不见了。无论如何,是否在下拉菜单的右侧添加了与文本相同颜色的向下箭头?我尝试了在此网站上找到的其他CSS类,但似乎没有任何效果。

现在显示的图像:Dropdown before

以及应该如何:Dropdown after

箭头也可以是另一个箭头。

任何帮助将不胜感激!

关于, 瓦斯科

1 个答案:

答案 0 :(得分:0)

这是为您提供的一个选项...现在...我使用了span.wpcf7-form-control-wrap,它专门围绕我正在设置样式的选择。您也可以(而不是)将选择内容包装到自定义div中。

这为我带来了结果

Example

我也使用剪切路径制作了三角形,因此您可以更改颜色或其他任何颜色。

/* Using the menu-813 which for me was the span around the select.*/
span.wpcf7-form-control-wrap.menu-813 {
    position: relative;
    height: 60px;
    background: #e9edf0;
    display: inline-block;
}
span.wpcf7-form-control-wrap.menu-813:after {
    content: '';
    position:absolute;
    width: 15px;
    height: 15px;
    background: #000;
    right:8px;
    top: 20px;
    z-index: 0;
    clip-path: polygon(100% 0, 0 0, 50% 100%);
}

.wpcf7-form select {
    -webkit-appearance: none;
    appearance: none;
    color: #72858a;
    font-size: 0.7777777778rem;
    background-color: transparent;
    border-color: #e9edf0;
    padding-top: 5px;
    padding-bottom: 5px;
    width: 300px;
    z-index: 1;
    position: relative;
    padding-left: 2ch;
}