用 CSS 樣式輸入型別重置


input 型別按鈕可以是提交按鈕或重置按鈕。藉助 CSS,我們可以為網頁上的任意按鈕設定樣式。

您可以嘗試執行以下程式碼來為 input 型別按鈕設定樣式

範例

即時演示

<!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>

更新時間: 23-Jun-2020

3K+ 瀏覽量

開啟你的 職業生涯

完成課程即可獲得認證

開始學習
廣告
© . All rights reserved.