将输入高度设置为父级的100% [英] Set input height 100% of parent
问题描述
我有一个小问题设置输入(类型文本)高度适合100%的父母( td
)height。我甚至试图迭代通过每个输入和手动设置它的高度jQuery,但它需要相当多的时间(网站我工作有很多单元格),仍然不工作在IE 7和8(我有使网站工作在这些)。以下是示例: http://st8.eu/test.html
这将是
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.
推荐答案
您不能设置 height:100%;
只要设置 td {height:30px; }
Just set td { height: 30px; }
and it should work.
实际上,我的最后一个链接不工作。经过几个研究,似乎没有一些JavaScript,你不能实现你想要的。但正如你所说,你试图使用JavaScript,所以我认为这应该是你要找的:回答同样的问题(看看它的小提琴)
看来,你不会有选择。
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.
这篇关于将输入高度设置为父级的100%的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!