HTML编写计算器样式
HTML编写计算器样式
代码如下
⽅法1:使⽤table⽅法
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible"content="IE=edge">
<meta name="viewport"content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<table >
<tr>
<td colspan="4">0</td> </tr>
<tr >
<td width="25%">AC</td>
<td width="25%">+/-</td>
<td width="25%">%</td>
<td width="25%">÷</td>
</tr>
<tr >
<td>7</td>
<td>8</td>
<td>9</td>
<td >*</td>
</tr>
<tr >
<td>4</td>
<td>5</td>
<td>6</td>
<td >-</td>
</tr>
<tr >
<td>1</td>
<td>2</td>
<td>3</td>
<td >+</td>
</tr>
<tr >
<td colspan="2">0</td>
<td>.</td>
<td >=</td>
</tr>
</table>
</body>
</html>
实现效果
⽅法⼆:使⽤div⽅法
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible"content="IE=edge">
<meta name="viewport"content="width=device-width, initial-scale=1.0"> <title>Document</title>
</head>
<style>
.out{
width: 360px;
height: 420px;
/* border: burlywood solid 1px; */
margin: auto;
margin-top: 100px;
}
.frame{
width: 360px;
height: 120px;
/* border: burlywood solid 1px; */
margin: auto;
background-color:rgb(90, 100, 99);
font-size: 30px;
color: honeydew;
text-align: right;
border-top-left-radius: 15px;
border-top-right-radius: 15px;
}
.red{
width: 10px;
height: 10px;
border-radius: 50%;
margin-left: 10px;
margin-top: 10px;
background-color: red;
background-color: red;
float: left;
}
.red:hover{
background-color:rgb(43, 29, 29); }
.bule{
width: 10px;
height: 10px;
border-radius: 50%;
margin-left: 10px;
margin-top: 10px; background-color:rgb(28, 28, 219); float: left;
}
.bule:hover{
background-color:rgb(17, 156, 149); }
.green{
width: 10px;
height: 10px;
border-radius: 50%;
margin-left: 10px;
margin-top: 10px; background-color: green;
float: left;
}
.green:hover{
background-color:rgb(187, 98, 38); }
.down{
width: 360px;
height: 300px;
/* border: burlywood solid 1px; */ margin: auto;
background-color:rgb(93, 105, 103); border-bottom-right-radius: 15px; border-bottom-left-radius: 15px;
}
.box{
width: 88px;
height: 58px;
border:rgb(222, 233, 225) solid 1px; float: left;
text-align: center;
font-size: 25px;
color: honeydew;
}
.yell{
background-color: chocolate;
}
.gray{
background-color: gray;
}
</style>
<body>
<div class="out">
<div class="frame">
<div >
<div class="red"></div>
<div class="bule"></div>
<div class="green"></div>
计算器
</div>
</div>
<div class="down gray">
<div class="box">AC</div>
<div class="box">C</div>
<div class="box">+/-</div>
<div class="box yell">%</div>
<div class="box">7</div>网页计算器html代码
<div class="box">8</div>
<div class="box">9</div>
<div class="box yell">+</div>
<div class="box">4</div>
<div class="box">5</div>
<div class="box">6</div>
<div class="box yell">-</div>
<div class="box">1</div>
<div class="box">2</div>
<div class="box">3</div>
<div class="box yell">*</div>
<div class="box">0</div>
<div class="box">.</div>
<div class="box yell">=</div> </div>
</div>
</body>
</html>
实现结果:⼩圆点可以实现变⾊
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论