使用 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.