利用 CSS 給輸入按鈕型別新增樣式


輸入按鈕型別可以是提交按鈕或重置按鈕。使用 CSS,我們可以給網頁中的任何按鈕新增樣式。

您可以嘗試執行以下程式碼,為輸入按鈕型別新增樣式

示例

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <style>
         input[type=button] {
            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 = "button" value = "Button">
      </form>
   </body>
</html>

更新於:24-Jun-2020

4K+ 瀏覽量

啟動您的 職業生涯

完成課程,獲得認證

立即開始
廣告