HTML CSS:将Google图标制作到“无矩形”按钮中



如何将Google图标制作到按钮中?但是,不要在按钮周围围绕矩形盒子。图标像素将是按钮本身。

.testdelete {
     font-family: Material Icons;
}
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<span class="testdelete">
 delete
</span>
  

链接下面的矩形围绕按钮,不需要。

https://www.w3schools.com/howto/howto_css_icon_buttons.asp

为什么不使用标签模拟按钮?

$( ".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:

<a href="#" class="button">

推文!

style.css:

.button { 
font-family: Material Icons;
vertical-align:middle; 
cursor: pointer; 
}
.text:hover{  
cursor: pointer; 
}

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
</head>
<body>
<i class="material-icons">cloud</i>
<i class="material-icons">favorite</i>
<i class="material-icons">attachment</i>
<i class="material-icons">computer</i>
<i class="material-icons">traffic</i>
</body>
</html>

相关内容

  • 没有找到相关文章

最新更新