Observe that border-box is the box-sizing property that we have selected. This ensures that the elements’ overall width and height include the padding and, eventually, borders.
See our CSS Box Sizing chapter for additional information on the box-sizingproperty.
Bordered Inputs
Change the bordersize and color with the border property, and add rounded corners with the border-radius property:
Certain browsers automatically encircle the input in blue when it receives focus, or a click. The behavior can be eliminated by adding outline: none; to the input.
When the input field comes into focus, use the :focusselector to do something with it:
----- BOX MUKVU -----
Example
-------Example MUKVA--------
Input with icon/image
Use the background-image property and the background-position property to position an icon inside the input if desired. Observe also that we have reserved the icon’s space by providing a significant left padding:
In this example, when the search input gains focus, its width is animated using the CSS transition property. Later on, in our CSS Transitionschapter, you will discover more about the transitionproperty.
To observe the effect, resize the browser window. Make the two columns stack on top of each other rather than next to each other when the screen width is less than 600 pixels.
Advanced: The next example builds a responsive form with media queries. In a subsequent chapter, this will be covered in further detail.