还只有一个界面,后续会添加实现代码
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>js台球</title>
</head>
<body>
<div class="table">
<div class="hole center top"></div>
<div class="hole center bottom"></div>
<div class="layer"></div>
<div class="hole left top"></div>
<div class="hole left bottom"></div>
<div class="hole right top"></div>
<div class="hole right bottom"></div>
</div>
<style type="text/css">
.table { width: 800px; height: 400px; border: 20px solid darkgreen; border-radius: 10px; position: relative; margin: 0 auto; }
.hole { width: 40px; height: 40px; border-radius: 20px; background-color: black; position: absolute; }
.hole.left { left: -20px; }
.hole.center { left: 50%; margin-left: -20px; }
.hole.right { left: 100%; margin-left: -20px; }
.hole.top { top: -20px; }
.hole.middle { top: 50%; margin-top: -20px; }
.hole.bottom { top: 100%; margin-top: -20px; }
.layer { position: absolute; width: 100%; height: 100%; left: 0; top: 0; background-color: green; }
</style>
</body>
</html>