要写一个HTML悬浮按钮,你需要使用HTML的button
元素,并使用CSS来设置按钮的样式。
下面是一个例子:
<style>
.floating-button {
position: fixed;
bottom: 20px;
right: 20px;
z-index: 100;
border: none;
outline: none;
background-color: red;
color: white;
cursor: pointer;
padding: 15px;
border-radius: 50%;
}
</style>
<button class="floating-button">+</button>