如何将 Google 图标制作成按钮?但是,不希望按钮周围有一个矩形框。图标像素本身就是一个按钮。
.testdelete {
font-family: Material Icons;
}
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<span class="testdelete">
delete
</span>
下面的链接在按钮周围放置了一个矩形,这是不想要的。
最佳答案
为什么不用标签来模拟按钮呢?
$( ".testdelete" ).click(function() {
$("p").hide();
});
.testdelete {
font-family: Material Icons;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<a class="testdelete">
delete
</a>
<p class="hi">To be deleted</p>
您还可以使用 <button>tweet</button>
并使用 css 处理背景和边框移除:
.button {
background: none;
border: none;
color: black;
}
关于HTML CSS : Make Google Icon into Button without Rectangle around it,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56925805/