[attribute=value], attribute equals value - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:attribute equals value

Description

The [attribute=value] selector selects elements with the specified attribute and value.

Example

Select <input type="text"> and change its width from 100px to 250px when focused.

Demo Code

ResultView the demo in separate window

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

Related Tutorials