HTML学习:计算器-最终版

本文详细介绍了如何使用HTML创建一个功能完善的计算器,涵盖了按钮点击事件、运算逻辑处理以及页面动态更新等核心内容。
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>计算器-最终形态</title>
		<style>
			.outside{
				width: 400px;
				height: 425px;
				background-color: darkgray;
				margin: 0 auto;
				border-top-left-radius: 10px;
				border-top-right-radius: 10px;
			}
			.button{
				width: 400px;
				height: 50px;	
				margin: 0 auto;	
					
			}
			#but1{
				width: 30px;
				color: red;
				font-size: 30px;
				float:left;	
			}
			#but2{
				width: 30px;
				color: yellow;
				font-size: 30px;
				float:left;	
			}
			#but3{
				width: 30px;
				color: blue;
				font-size: 30px;
				float:left;	
			}
			.show{
				width: 380px;
				height: 50px;
				background-color: white;
				border:solid 2px red;
				margin: 0 auto;
			}
			
			#abc div{
				width: 96px;
				height: 60px;
				float:left;	
				background-color: aqua;
				margin: 2px ;
				text-align:center;
				line-height:60px;
	            font-size: 25px; 
	            border-radius:5px;
			}
			#abc div:hover{
				background-color: orangered;
			}
			
		</style>
	</head>
	<body>
		<div class="outside">
			<!--外部-->
			<div class="button">
				<div id="but1">●</div>
				<div id="but2">●</div>
				<div id="but3">●</div>
			</div>
			<div class="show">	
				
			</div>
			<div class="keyboard" id="abc">
				<div>AC</div>
				<div>+/-</div>
				<div>%</div>
				<div>&divide;</div>
				<div>7</div>
				<div>8</div>
				<div>9</div>
				<div>&times;</div>
				<div>4</div>
				<div>5</div>
				<div>6</div>
				<div>-</div>
				<div>1</div>
				<div>2</div>
				<div>3</div>
				<div>+</div>
				<div>0</div>
				<div>&lt;-</div>
				<div>.</div>
				<div>=</div>
			</div>
				
			
		</div>
	</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值