HTML CSS examples for CSS Selector:attribute equals value
The [attribute=value] selector selects elements with the specified attribute and value.
Select <input type="text"> and change its width from 100px to 250px when focused.
<!DOCTYPE html> <html> <head> <style> input[type=text] { width: 100px; -webkit-transition: width .35s ease-in-out; transition: width .35s ease-in-out; } input[type=text]:focus { width: 250px; } </style><!--from w ww.j a va2 s . c om--> </head> <body> Search:<input type="text" name="search"> URL:<input type="url" name="url"> Number:<input type="number" name="number"> Button: <input type="button" name="button"> </body> </html>