制作具有透明背景和不同图标的按钮

making a button with transparent background and different icons

我是样式表的新手。我想在我的表单上做一个这样的按钮。

我怎样才能做到这一点。

当您想在 HTML/CSS 中做一些基本的事情时,通常有多种方法可以做到。这是一个使用 "flexbox" 样式的简单解决方案:

<div style="display: flex">
  <img src="yourIcon.png"/>
  <span>Clear Selections</span>
</div>

您还可以使用 float 样式、基于 position: absolute 的样式等。

<button class='myBtn'>
  <svg></svg> // here should be an svg get it from the internet
  <span>Clear Selections<span>
</button>
.myBtn {
 display: flex;
 border: 1px solid gray;
 color: black;
 background: ; // ur color here
}

在发布此类问题之前也尝试进行研究