Here is one approach using a wrapper around the input element.
Suppose you have the following HTML:
<div class="input-wrap"> <input type="text" value="Search..."> </div>
Apply the following CSS:
.input-wrap { display: inline-block; position: relative; border-bottom: 1px solid red; border-left: 1px solid red; height: 10px; width: 100px; } .input-wrap input { position: absolute; bottom: 0; left: 0; width: inherit; border: none; background-color: beige; }
Fiddle: http://jsfiddle.net/audetwebdesign/rLCHa/
In this design, the external .input-wrap
element controls the width of the input field and the bottom border, as well as the height of the left border (10px in this example).
The input field is positioned absolutely and fixed at the bottom of the parent container and inherits the width. The height of the input field is the default, but you can control it regardless of the height set in the .input-wrap
element.
source share