先看效果图
html部分
<body>
<div >
<input type="text" value="" placeholder="请输入验证码" id="text" class="input-val"/>
<canvas id="canvas" width="106" height="43"></canvas>
</div>
</body>
css部分
<style type="text/css">
body{
margin-top: 12.5rem;
margin-left: 200px;
text-align: center;
}
div{
width: 300px;
height: 200px;
}
input{
width: 110px;
height: 40px;
border-color: skyblue;
border-width: 1.5px;
border-radius: 30px;
border-style: solid;