managing the orientation of an input box is expanded within HTML

I'm currently reviewing the HTML and CSS code for a website at http://preview.python.org/ but there are some things I don't quite grasp. One thing that caught my eye is the search-box - how did they achieve the icon-search feature? I doubt it's just a simple image file like a jpg or png, so how exactly was it created? Another interesting element is how the input box extends from right to left when you focus on it. My tests with other input boxes didn't yield the same result. Can someone shed some light on how this effect is achieved? Any help would be greatly appreciated.

Answer â„–1

To achieve this effect, you can utilize the CSS transition property. Take a look at the sample code provided below:

HTML:

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
  <script>
    function resetWidth(){
      console.log("function called");
        document.getElementById("inputBox").style.width="100px";
    }
  </script>
</head>
<body onmousedown="">
  <input type="text" class="inputBox" id="inputBox" onchange="resetWidth()">
</body>
</html>

CSS:

input {
width: 100%;
padding: .65em;
margin-bottom: .875em;
border: 1px solid #caccce;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
-ms-border-radius: 6px;
-o-border-radius: 6px;
border-radius: 6px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
  width:100px;  
    float:right;
    position:relative;

}

.inputBox{
  -webkit-transition: width .3s ease-in-out; 
  -moz-transition:width .3s ease-in-out; 
  -o-transition: width .3s ease-in-out;  
  transition:width .3s ease-in-out;  

}
#inputBox:focus
{ 
width:200px;  
} 

Live Demo For Further Clarification

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

"Enhancing user experience with jQuery hover effects on table

This is an example of the HTML structure: <tr class="row-1 row-first"> <td class="col-1 col-first"> <div class="views-field views-field-field-logo-image"></div> <div class="views-field views-field-field-logo-title"> ...

After filling out the form, the user's entered information is instantly shown on the same page

I want to create a form where my friend can input information that will be displayed on the same page. For example, when he enters the title in a text field and clicks submit, it should appear in the title box. Additionally, he should be able to enter va ...

The button appears to be unresponsive following the addition of jQuery 1.9.1

Take a look at this code snippet: http://jsfiddle.net/cwWWN/ I'm fairly new to using jQuery and I'm trying to create an Add and Delete button functionality for adding and removing rows in a table. However, I've encountered a problem where t ...

Struggling to align menu items horizontally with CSS? Using the inline property just isn't cutting it

I'm struggling to get my menu to display horizontally, no matter what I try. What am I doing wrong? I think the issue might be with the inline option, but I'm not certain. If someone could help correct my code, I would be very grateful. Thank you ...

How can I customize the appearance of the container and items in a dropdown <select> menu?

Im using contact form 7 on wordpress, i don't want to use a plugin rather use plain css/js to bring the results if possible. Something like this : https://i.stack.imgur.com/VTWRg.jpg ...

Is the CSS 'position: absolute' applied to the element immediately following the body tag

Quoting from msdn: "The object is placed relative to the position of its parent element—or to the body element if the parent element is not positioned" Let's consider a scenario where I set a div with specific dimensions to have a bottom value ...

Troubleshooting problem with iPhone X responsiveness

Struggling with responsive issues on iPhone X. Issue is only appearing on actual device. Any tips for fixing this? I'm facing an issue where the website looks good and responsive on all devices in Chrome's responsive view. But when I access it th ...

Checking the validity of a form input in HTML before submission

Can inputs in a form be validated using HTML alone? Consider the following scenario: <input type="text" class="input-text error" aria-required="true" placeholder="Enter your name *" aria-invalid="true&qu ...

Tips for accessing images in Angular 24 lazy loaded modules

I have a collection of images that need to be shared throughout my application. There are 2 lazy-loaded modules - Login and Overview. The image I require is located in src/assets/images/logo.png and needs to be accessible in both the Login and Overview com ...

The option to clear searches is missing from the iOS interface

My application is designed to perform searches using post codes, and for the most part, it functions properly. However, I have encountered an issue where the clear icon on the right-hand side of the field does not display in certain browsers. To investiga ...

What is the best way to ensure that an image perfectly fits within a div container?

My goal is to make my image occupy half of the div's width and 100% of the height. However, I am facing an issue with a lingering white bar at the bottom. Can you offer some guidance on how to resolve this? Take a look at the site preview .contain ...

Manipulate a 3D shape by transforming both the x and y axes using jQuery's mousemove

I am trying to create a 3D element that rotates on both the x and y axes based on the position of the mouse on the screen. While I have successfully achieved this effect using either the X or Y position, I am struggling to make it work simultaneously for b ...

Customizing the appearance of default UI elements in asp.net

Recently, I was tasked with creating an image uploading function for a web application using asp.net. To start off, I utilized the standard input asp.net button along with the browse and filename label. The implementation of this code is quite straightforw ...

ng-disabled directive not functioning as expected

Trying to develop a customized button directive, I aim to utilize the ng-disabled attribute and link it to a variable within the scope. Check out the HTML snippet below: <div ng-controller="MyCtrl"> <btn dis="disableBtn"></btn> </d ...

How can I locate and modify a particular cell within an HTML table using just JavaScript?

For my project, I am required to develop a functional shopping cart with a remove function. If an item is already in the cart, it should update the existing data when added again. Let's say I have the following items in my cart: Name: Quantity: Pric ...

Are there CSS styles that target specific elements?

My goal is to design a unique and custom theme for blender.stackexchange. However, I am facing an issue where the rules I implement only affect certain tags when viewed in FF 29.0.1 Despite all tag elements having the same classes, parent elements, etc., ...

Expanding section beneath a Row in a Table (Semantic UI React)

I'm attempting to implement expandable Table Rows in a Table that can be activated by clicking on them individually. For instance, upon clicking on the designated area in the provided image below, a Segment or Container will reveal itself with embedd ...

Retrieve the text from a string resource in Android while preserving HTML tags

When working on my app, I encountered an issue with displaying a string in a text view while utilizing html markup. Here is how I attempted to retrieve the string: String mystring = getResources().getString(R.string.Terms_And_Conditions); Unfortunately, t ...

Instructions on utilizing clean-css with Node.js to process incoming requests

I need help finding a way to pipe request output into clean-css for minification and then return it as a response. The application I am working on is using restify framework. Here is an example of what I'm trying to accomplish: var url = "http://www ...

Is it possible to include a link to an external page and execute a JavaScript function on that page simultaneously

I am attempting to link directly to an external page that displays a list of order numbers which are loaded via AJAX when clicked. The URL of the external page is http://www.example.com/orders and it uses a JavaScript function javascript:load_order('X ...