Menu
CoddyTech

复习挑战

本课属于 Coddy HTML 学习旅程的“精通 CSS”单元。第 11 课,共 43 课。

challenge icon

挑战

简单

在这个复习挑战中,你将结合学过的所有交互式伪类,创建一个完全可交互的导航按钮。

你的任务是为给定的 HTML 代码添加样式,实现以下效果:

  • 鼠标悬停在按钮上时,背景颜色应变为绿色,字体大小应为 20px。
  • 当输入框获得焦点时(点击输入框或在其中输入时),背景颜色应为黄色,并显示黑色边框。边框粗细和样式可以由你决定,没有具体要求。

亲手试试

<!DOCTYPE html>
<html>
<head>
    <title>Recap Challenge</title>
    <style>
        /* General page styling */
        body {
            font-family: Arial, sans-serif;
            padding: 20px;
            background-color: #f0f8ff;
        }
        input {
            padding: 8px;
            font-size: 16px;
            border: 2px solid #ccc;
        }
        a {
            display: inline-block;
            margin-top: 10px;
            color: #0077cc;
            text-decoration: none;
        }
        /* Write your CSS here */

    </style>
</head>
<body>
    <h1>Join the Jungle Adventure!</h1>
    <p>Ready to embark on an epic journey? Sign up below:</p>

    <button>Start Adventure</button>

    <br><br>

    <input type="text" placeholder="Enter your explorer name">

    <br><br>

    <a class="more" ref="#">Learn more about the adventure</a>
</body>
</html>

精通 CSS中的所有课

自己练习: Web 在线编辑器