I need some help with designing a search box similar to the layout on Google's homepage. I want it to be centered, but when clicked on, I would like it to float to the top left corner of the screen. I have been able to modify the size of the search box, but I am struggling to position it as desired.
<style>
input[type=text] {
width: 450px;
}
input[type=text]:focus {
width: 130px;
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
font-size: 16px;
background-color: white;
background-image: url('searchicon.png');
background-position: 10px 10px;
background-repeat: no-repeat;
padding: 12px 20px 12px 40px;
-webkit-transition: width 0.4s ease-in-out;
transition: width 0.4s ease-in-out;
}
</style>
<form id="form1" action="/search.php" method='GET' style="padding: 20px">
<center>
<h1>My Search Engine</h1>
<p>
<input name="search" id="search" type="text" class="footer1" size='50' placeholder=" Enter your search query here...."></p>
<p> </p>
</center>
<body>
<p class="footer1">
<center>
<input name='submit' type='submit' class="md-trigger md-setperspective search" value='Submit'>
</center>
</p>
</form>
</body>