javascript - 在按钮角上打勾
问题描述
我想在右上角的按钮上打勾。我将输入值设置为它给了我一个带有刻度线的按钮文本,我希望它应该放在右上角。
.buttoner{
background-color: #4CAF50;
border: none;
cursor: pointer;
height: 48px;
border-radius: 5px;
width: 10%;
}
<input type="button" class="buttoner" value="buttoner✓"/></input>
我想要这样:
解决方案
.my-btn {
position: relative;
display: inline-block;
}
.buttoner {
background-color: #66bb6a;
border: none;
cursor: pointer;
height: 48px;
border-radius: 3px;
width: 120px;
text-align: center;
color: white;
line-height: 48px;
font-size: 14px;
font-weight: bold;
}
.my-btn .fa-check {
position: absolute;
top: 5px;
right: 10px;
color: #fff;
font-weight: normal;
}
<!DOCTYPE html>
<html>
<head>
<title>Button with tick mark</title>
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="my-btn">
<input type="button" class="buttoner" value="Button"/>
<i class="fa fa-check"></i> </div>
</body>
</html>