您可以嘗試執行以下程式碼來實作: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 偽類的用法的詳細內容。更多資訊請關注PHP中文網其他相關文章!