CSS Textarea在ie中垂直调整大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9712805/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Textarea resize vertical in ie
提问by user983208
How do i resize my textarea vertically in IE?
如何在 IE 中垂直调整文本区域的大小?
I did resize: vertical and it works well in Firefox but in IE it doesn't work. So what's the alternative for this?
我确实调整了大小:垂直,它在 Firefox 中运行良好,但在 IE 中不起作用。那么这个的替代方案是什么?
Also, if I want to print the page, then I need the textarea to extend and print the whole contents in the box. What should I use for this?
另外,如果我想打印页面,那么我需要 textarea 扩展并打印框中的全部内容。我应该为此使用什么?
edited -
编辑 -
My CSS:
我的CSS:
@media screen {
textarea {
resize: vertical;
overflow: auto;
border: 1px #999999 solid;
padding: 6px;
background: #ffffff url('../images/field_bg.png') repeat-x bottom;
width: 400px;
height: 100px;
}
}
@media print {
textarea {
border: 1px #999999 solid;
padding: 6px;
background-color: #ffffff;
background-image : none;
width: 400px;
height: auto;
overflow: visible;
}
}
.field {
display: inline;
vertical-align: top;
width: 25%;
}
HTML -
HTML -
<div class="field">
<textarea id="xp">
some text here
</textarea>
</div>
Edited -
编辑 -
I still can't figure out the solution for this. Can anybody help please?
我仍然无法找出解决方案。有人可以帮忙吗?
回答by TJ.
The css resize property is not (yet) supported by IE. You may want to try this jquery ui plugin: http://jqueryui.com/demos/resizable/. Here's a fiddleto demonstrate.
IE 尚不支持 css resize 属性。你可能想试试这个 jquery ui 插件:http: //jqueryui.com/demos/resizable/。这里有一个小提琴来演示。
For your second question regarding printing in IE. Try add the following CSS to the media="print" block:
关于在 IE 中打印的第二个问题。尝试将以下 CSS 添加到 media="print" 块:
textarea {
overflow: visible;
}
回答by draconis
I'm not sure but as i know Internet Explorer doesn't support that. You can use javascript for that. Here is a jquery plugin similar to this textarea i'm typing now : http://archive.plugins.jquery.com/project/TextAreaResizer
我不确定,但据我所知 Internet Explorer 不支持。您可以为此使用 javascript。这是一个类似于我现在正在输入的 textarea 的 jquery 插件:http: //archive.plugins.jquery.com/project/TextAreaResizer