css - Transition on search box not working -
i'm trying expand width of search box when focus. works fine transition not working. please put light on it, wrong in these code. couldn't figure out.
//css file // class name of div(.searchbox) .searchbox { margin: 100px auto; width: 300px; height: 200px; background-color: #ccc; padding-left: 20px; padding-top: 20px; -webkit-transition: 2s easy-in-out; -moz-transition: 2s easy-in-out; transition: 2s easy-in-out; } // class name of input box .search { padding: 10px; font-size: 1em; } /* input[type="search"]:focus { width: 250px; background-color: #ddd; } */ .searchbox form .search:focus { width: 250px; background-color: #444; }
the code these after changes (unfortunately transition not working)
try this,
.searchbox { margin: 100px auto; width: 300px; height: 200px; background-color: #ccc; padding-left: 20px; padding-top: 20px; } .search { padding: 10px; font-size: 1em; width: 130px; -webkit-transition: 2s ease-in-out; -moz-transition: 2s ease-in-out; transition: 2s ease-in-out; } .searchbox .search:focus { width: 250px; background-color: #444; }
<div class="searchbox"> <input type="text" placeholder="search" class="search"> </div>
Comments
Post a Comment