views:

285

answers:

3

I tried:

font-size:40%;

But found it not working

A: 

You could use em as a size. Em is the size of the font. .5 em is 1/2 the size of the font.

Dr. Zim
Not working:(
Shore
+1  A: 

You have to provide the width and height attribute values of the input tag

<input type="text" style="width: 50px; height: 10px" />

or you can use a class for this

<style>
.SmallInput { width: 50px; height: 10px; }
</style>

<input type="text" class="SmallInput" />

font-size only reduces the size of the font inside the text box and not the dimension of it.

rahul
How to make the "input" 40% of its original size?width=40% will make it 40% of its parent,not its original size.
Shore
Units in % always are applied relative to the parent. Also each and every browser has its own default width and height for the controls. So it won't be same in every browser.
rahul
A: 

Unfortunately the height of the text box is User-agent specific thing, I believe that FF, Opera, and IE will treat it like a box object while Safari (and possibly FF on Mac?) use the OSX controls and are not adjustable. IE6 box model is broken of course.

John F. Miller