首頁  >  文章  >  web前端  >  CSS :focus 偽類的用法

CSS :focus 偽類的用法

王林
王林轉載
2023-08-26 15:01:081245瀏覽

您可以嘗試執行以下程式碼來實作:focus 偽類別

範例

#現場示範

<!DOCTYPE html>
<html>
   <head>
      <style>
         input:focus {
            background-color: orange;
         }
      </style>
   </head>
   <body>
      <form action = "">
         Subject <input type = "text" name = "subject"><br>
         Student: <input type = "text" name = "student"><br>
         Age: <input type = "number" name = "age"><br>
         <input type = "submit" value = "Submit">
      </form>
   </body>
</html>

輸出

CSS :focus 伪类的用法

以上是CSS :focus 偽類的用法的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:tutorialspoint.com。如有侵權,請聯絡admin@php.cn刪除