js+css编写的一个计算器效果代码
代码语言:html
所属分类:布局界面
代码描述:js+css编写的一个计算器效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
@import url("https://fonts.googleapis.com/css2?family=Lato&family=Plaster&display=swap");
@font-face {
font-family: "Digital dream Regular";
font-style: normal;
font-weight: normal;
src: url("//repo.bfw.wiki/bfwrepo/font/digital-dream.regular.woff") format("woff");
}
*::after,
*::before,
* {
margin: 0;
padding: 0;
box-sizing: inherit;
}
html {
font-size: 62.5%;
}
body {
box-sizing: border-box;
background-color: #E0E0E0;
font-family: "Lato", sans-serif;
}
.calculator {
width: 40rem;
height: 60rem;
margin: 5rem auto;
}
.calculator__top {
width: 40rem;
height: 20rem;
padding: 1.2rem;
background-color: rgba(0, 0, 0, 0.9);
border-top-right-radius: 2.5rem;
border-top-left-radius: 2.5rem;
display: flex;
flex-direction: column;
justify-content: space-evenly;
position: relative;
}
.calculator__top h1 {
color: rgba(255, 255, 255, 0.9);
font-family: "Plaster", cursive;
}
.calculator__top--display {
width: 100%;
height: 12rem;
border: 1.5rem solid #494D56;
background-color: rgba(255, 255, 255, 0.7);
border-radius: 1rem;
font-size: 1.6rem;
text-align: right;
color: black;
padding: 0.5rem;
font-family: "Digital dream Regular";
}
.calculator__top--display.on {
background-color: #48A1BE;
}
.calculator__top:after {
content: linear-gradient(105deg, rgba(224, 224, 224, 0.3) 31%, transparent 33%);
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
.calculator__middle {
width: 100%;
height: 3rem;
background-color: #5f626e;
position: relative;
}
.calculator__middle--top {
border: 1px solid black;
border-bottom: none;
width: 100%;
height: 1.5rem;
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.5);
}
.calculator__middle--bottom {
width: 100%;
height: 1.5rem;
}
.calculator__middle--junction {
position: absolute;
top: 1.5rem;
left: 10%;
width: 80%;
height: 1rem;
border-bottom: 1px solid black;
border-left: 1px solid black;
border-right: 1px solid black;
background-color: #5f626e;
box-shadow: inset 0 -1.5px 2px rgba(0, 0, 0, 0.5);
}
.calculator__bottom {
width: 40rem;
height: 31rem;
padding: 1rem;
border: 5px solid #5f626e;
border-bottom-right-radius: 2.5rem;
border-bottom-left-radius: 2.5rem;
display: grid;
grid-gap: 0.6rem;
justify-content: center;
align-items: center;
justify-items: center;
grid-template-columns: repeat(6, 1fr);
grid-template-rows: repeat(7, 1fr);
background-image: url("https://assets.codepen.io/4439736/gray-shiny.jpg");
background-size: cover;
background-position: left;
}
.calculator__bottom--item {
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0