I have a little problem with setting input (type text) height to fit 100% of parents (td
) height. I even tried to iterate through every input and set it height manually with jQuery, but it takes quite a lot of time (site I am working on has a lot of cells) and still doesn't work on IE 7 and 8 (I have to make site work under those too). Here is a sample: http://st8.eu/test.html
It would be greatly appreciated if anybody knows any solution/hack.
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
- Adding a timeout to a render function in ReactJS
You can set
position:absolute
to the input.Here a Fiddle example (note that you must also set a width for the
<td>
that contains the input):It works also with
<input type="submit">
and<div>
.Tested on Firefox and Chrome
UPDATE: Doesn't work in Explorer, you can set a min-height to the input to make it at least usable.
UPDATE2: For Dracco, here a Fiddle implementing your example.
You cannot set
height:100%;
on an element if the parent hasn't a set height.Just set
td { height: 30px; }
and it should work.Actually, my last link was not working. After a few researches, it seems that you cannot achieve what you want without some JavaScript. But as you said, you tried to use JavaScript, so I assume this should be what you're looking for : Answer to the same kind of question (Have a look at its fiddle.) Seemingly, you won't have the choice.
Somehow setting table height to 100% works.
css:
html: