<!DOCTYPE html>
<html>
  <head>
    <title>My Fun Game</title>
    <style>
      body {
        background-color: #353945;
        font-family: sans-serif;
        text-align: center;
      }
<pre><code>  .container {
    margin: 0 auto;
    width: 500px;
    padding-top: 10%;
  }

  h1 {
    font-size: 3em;
    color: #FFFFFF;
    margin-bottom: 20px;
  }

  .score {
    font-size: 2.5em;
    color: #FFFFFF;
    margin-bottom: 20px;
  }

  button {
    font-size: 1.5em;
    padding: 5px 10px;
    background-color: #FFD700;
    border-radius: 10px;
    border: none;
    color: #FFFFFF;
  }

  button:hover {
    background-color: #FFA500;
    cursor: pointer;
  }
&lt;/style&gt;
</code></pre>
  </head>
  <body>
    <div class='container'>
      <h1>My Fun Game</h1>
      <div class='score'>Score: <span id='score'>0</span></div>
      <button onclick='increaseScore()'>Click Me!</button>
    </div>
    <script>
      let score = 0;
<pre><code>  const increaseScore = () =&gt; {
    score++;
    document.getElementById('score').innerHTML = score;
  }
&lt;/script&gt;
</code></pre>
  </body>
</html>

原文地址: https://www.cveoy.top/t/topic/lnhT 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录