console
<!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>
<link rel="stylesheet" href="./index.css">
</head>
<body>
<div class="wrapper">
<div class="car">购物车</div>
<button class="btn">添加按钮</button>
<div class="ball" >
<span>+</span>
</div>
</div>
<script src="./index.js"></script>
</body>
</html>
* {
margin: 0;
padding: 0;
text-align: center;
}
html, body {
height: 100%;
}
:root {
--carSize: 70px;
--ballSize: 30px;
--btnSize: 100px;
--color: rgb(91, 167, 229)
}
.wrapper {
width: 375px;
height: calc(100% - 20px);
border: 1px solid;
position: relative;
box-sizing: border-box;
margin: 10px;
}
.car {
width: var(--carSize);
height: var(--carSize);
border-radius: 50%;
background-color: var(--color);
position: fixed;
bottom: 30px;
left: 30px;
font-size: 12px;
line-height: var(--carSize);
color: white;
}
.btn {
width: var(--btnSize);
height: calc(var(--btnSize) / 2);
background-color: var(--color);
border-radius: 3px;
color: white;
outline: none;
border: none;
position: absolute;
right: 20px;
top: 100px;
}
.ball {
width: var(--ballSize);
height: var(--ballSize);
border: 1px solid;
border-radius: 50%;
position: absolute;
left: 20px;
top:20px;
}
.ball span {
width: var(--ballSize);
height: var(--ballSize);
border-radius: 50%;
background-color: var(--color);
font-size: 20px;
line-height: calc(var(--ballSize) - 4px);
font-weight: 700;
color: white;
position: absolute;
left: 0;
top: 0;
}