HTML 篮球比赛计时记分器

效果图程序较短,为方便使用,html,css,js,写在了一起,很多东西写着才添加<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial...
摘要由CSDN通过智能技术生成

效果图

在这里插入图片描述

程序较短,为方便使用,html,css,js,写在了一起,很多东西写着才添加

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>篮球计时计分器</title>
    <style>
        #parent{
    
            position: relative;
        }
        /* 计时 */
        #parent div{
    
            border: 1px solid black;
            color: black;
            display: inline-block;
            text-align: center;
        }
        div:hover{
    
            cursor: pointer;
        }
        #parent .big{
    
            height: 500px;
            width: 300px;
            font-size: 240px;
            line-height: 500px;
            background-color: yellow;
        }
        #minute{
    
            position: absolute;
            top:50px;
            left: 400px;
            border-radius: 50px 0 0 0;
        }
        #second{
    
            position: absolute;
            top:50px;
            left: 700px;
        }
        #parent .middle{
    
            height: 250px;
            width: 250px;
            font-size: 200px;
            line-height: 250px;
            position: absolute;
            top: 300px;
            left: 1001px;
            background-color: yellow;
        }
        #parent .small{
    
            height: 95px;
            width: 136.5px;
            font-size: 27px;
            line-height: 100px;
            background-color: grey;
        }
        #parent .contain{
    
            position: absolute;
            top: 554px;
            left: 400px;
        }
        #parent #start{
    
            background-color: yellow;
        }
        /* 计分 */
        .score{
    
            width: 300px;
            height: 560px;
            border: 1px solid black;
            position: absolute;
            top: 100px;
            overflow: hidden;
        }
        .team{
    
            height: 100px;
            overflow: hidden;
            border: 1px solid black;
            border-radius: 3px 3px 0 0;
        }
        .team input{
    
            height: 100px;
            width: 300px;
            font-size: 50px;
            text-align: center;
        }
        #score1{
    
            left: 105px;
            /* border-radius: 100px 0 0 0; */
        }
        #score2{
    
            left: 1262px;
            /* border-radius: 0 100px 0 0; */
        }
        .score11{
    
            width: 300px;
            height: 360px;
            background-color: purple;
            color: white;
            font-size: 180px;
            text-align: center;
            line-height: 360px;
        }
        .add{
    
            width: 53px;
            height: 98px;
            display: inline-block;
            border: 1px solid black;
            background-color: yellow;
            color: black;
            font-size: 25px;
            text-align: center;
            line-height: 98px;
        }
        .less
  • 5
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是一个简单的HTML篮球比赛计分的示例代码,其中使用了CSS样式来设置布局和样式: ```html <!DOCTYPE html> <html> <head> <title>Basketball Scoreboard</title> <style> body { font-family: Arial, sans-serif; background-color: #f2f2f2; } .container { display: flex; flex-direction: row; justify-content: center; align-items: center; height: 100vh; } .team { display: flex; flex-direction: column; align-items: center; margin: 0 20px; background-color: #fff; padding: 20px; border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); } .team h2 { margin: 0; font-size: 36px; color: #333; } .team p { margin: 0; font-size: 24px; color: #666; } .score { display: flex; flex-direction: row; align-items: center; margin-top: 20px; } .score button { background-color: #333; color: #fff; border: none; font-size: 36px; padding: 10px 20px; border-radius: 5px; margin: 0 10px; cursor: pointer; } .score button:hover { background-color: #666; } .score button:active { transform: translateY(2px); } .score span { font-size: 48px; font-weight: bold; color: #333; margin: 0 20px; } </style> </head> <body> <div class="container"> <div class="team"> <h2>Team A</h2> <p>Player 1, Player 2, Player 3</p> <div class="score"> <button onclick="incrementScore('teamA', 1)">+1</button> <button onclick="incrementScore('teamA', 2)">+2</button> <button onclick="incrementScore('teamA', 3)">+3</button> <span id="teamAScore">0</span> </div> </div> <div class="team"> <h2>Team B</h2> <p>Player 4, Player 5, Player 6</p> <div class="score"> <button onclick="incrementScore('teamB', 1)">+1</button> <button onclick="incrementScore('teamB', 2)">+2</button> <button onclick="incrementScore('teamB', 3)">+3</button> <span id="teamBScore">0</span> </div> </div> </div> <script> var teamAScore = 0; var teamBScore = 0; function incrementScore(team, points) { if (team === 'teamA') { teamAScore += points; document.getElementById('teamAScore').innerHTML = teamAScore; } else if (team === 'teamB') { teamBScore += points; document.getElementById('teamBScore').innerHTML = teamBScore; } } </script> </body> </html> ``` 该示例代码使用了flex布局来实现两个球队的布局,并使用CSS样式来设置球队名称、得分和按钮的样式。JavaScript代码用于处理得分逻辑,并将得分更新到HTML页面上。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值