Html Forms with CSS Focus Animation transition:0.5s; Style code
<!DOCTYPE html>>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="nav.css">
<title>Html Form</title>
</head>
<body>
<p>In this example, we use the :focus selector to add a black border color to the text field when it gets focused (clicked on):</p>
<p>Note that we have added the CSS transition property to animate the border color (takes 0.5 seconds to change the color on focus).</p>
<form>
<label for="fname">First Name::</label><br>
<input type="text"id="fname"placeholder="You First Name"><br>
<label for="lname">Last Name::</label><br>
<input type="text"id="lname"placeholder="You Last Name"><br>
</form>
</body>
</html>
CSS Focus Animation transition:0.5s; Style
input[type=text]{
width:100%;
padding:12px 20px;
margin:8px 0;
box-sizing: border-box;
border: 3px solid #ccc;
-webkit-transition:0.5s;
transition:0.5s;
}
input[type=text]:focus{
border:3px solid #555;
}
No comments:
Post a Comment