我想在XHTML 1.0 Transitional中将TextArea的高度设置为表格单元格的100% [英] I want to set the height of a TextArea to 100% of a Table Cell in XHTML 1.0 Transitional

查看:47
本文介绍了我想在XHTML 1.0 Transitional中将TextArea的高度设置为表格单元格的100%的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在XHTML 1.0 Transitional中将TextArea的高度设置为其父表单元格的100%.我环顾了其他向我表达的类似问题,即父元素需要具有一个明确定义的高度值,以使TextArea的高度为该值的100%.

I want to set the height of a TextArea to 100% of its parent table cell in XHTML 1.0 Transitional. I looked around at other similar questions that expressed to me that the parent element needs to have an explicitly defined height value in order for the TextArea's height to be 100% of that value.

我有一个表格,该表格是html高度的100%,并且正文设置为100%.

I have a table that is 100% of the height of the html and body wich are set to 100%.

但是,如果我将表格单元格的值设为其父级的100%,将行设为其父级的100%,并将表格设为其父级的100%,则将其设置为客户端高度的100%,我猜,文本区域会填满整个视口.

However, if I put the Table Cell's value as 100% of its parent, the row as 100% of its parent, and the table as 100% of its parent, which is set to 100% of the client height, I'm guessing, the textarea fills the entire viewport.

我如何将TextArea的高度简单地设置为表格单元格的100%,而不会一直引用父元素的高度值直到根,而得到的结果却远非我所追求的?

How would I set the height of the TextArea as simply 100% of the table cell without referencing the height value of a parent element all the way up to the root, and getting a result far from what I am after?

代码如下:

<table>
<tr>
<td>
<textarea rows="" cols="">
</textarea>
</td>
</tr>
<tr>
<td>
<textarea rows="" cols="">
</textarea>
</td>
</tr>
</table>

外部CSS:

html, body {
height: 100%;
width: 100%;
}
table {
height: 100%;
width: 100%;
}
textarea {
height: 100%;
width: 100%;
}

注意:由于某些奇怪的原因,width属性似乎可以很好地分配,而无需引用直接父级,而height却没有.

NOTE: For some odd reason, the width property seems to assign fine without reference to a direct parent, but the height doesn't.

推荐答案

将CSS更改为:

html, body {
height: 100%;
width: 100%;
}
table {
height: 100%;
width: 100%;
}
textarea {
height: 100%;
width: 100%;
}
td{
    height:50%;
}

这篇关于我想在XHTML 1.0 Transitional中将TextArea的高度设置为表格单元格的100%的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆