使用 CSS 设置 input type reset 样式


input type 按钮可以是提交按钮或重置按钮。使用 CSS,我们可以设置网页上任何按钮的样式。

你可以尝试运行以下代码为 input type 按钮设置样式

示例

实时演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         input[type = submit], input[type = reset] {
            background-color: orange;
            border: none;
            text-decoration: none;
            color: white;
            padding: 20px 20px;
            margin: 20px 20px;
            cursor: pointer;
         }
      </style>
   </head>
   <body>
      <p>Fill the below form,</p>
      <form>
         <label for = "subject">Subject</label>
         <input type = "text" id = "subject" name = "sub"><br><br>
         <label for = "student">Student</label>
         <input type = "text" id = "student" name = "stu"><br>
         <input type = "reset" value = "Reset">
         <input type = "submit" value = "Submit">
      </form>
   </body>
</html>

更新于:2020-06-23

3K+ 浏览量

开启您的 职业生涯

通过完成课程获得认证

开始学习
广告
© . All rights reserved.