首页 > 解决方案 > 有没有办法让自定义 CSS 按钮在背景中透明?

问题描述

我正在尝试使用 css 制作自定义播放按钮。我到了我有这个的地步:

.play{
	height: 74px;
	border-width: 37px 0px 37px 67px;
	padding-right: 0;
	border-color: transparent transparent transparent #33ffff;
        margin-top:25px;
        margin-left:25px;
	margin-bottom:25px;
}

#body{
       background-color:red;
}
<div id="body">
		<button class="play" id="playB"></button>
</div>

我只是想知道当border-color: transparent transparent transparent #33ffff;背后有背景时是否有任何方法可以使实际透明?我不想看到灰色。

标签: css

解决方案


当然,灰色是背景。也将其设置为透明。

.play{
	height: 74px;
	border-width: 37px 0px 37px 67px;
	padding-right: 0;
	border-color: transparent transparent transparent #33ffff;
        margin-top:25px;
        margin-left:25px;
	margin-bottom:25px;
	background: transparent
}

#body{
       background-color:red;
}
<div id="body">
		<button class="play" id="playB"></button>
</div>


推荐阅读