如何设置身高和HTML中的widthof表 [英] how to set height & widthof table in HTML

查看:84
本文介绍了如何设置身高和HTML中的widthof表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,



可能这是一个非常简单的问题,我会问,但我谷歌也一样,但我不满意。 />
我只想设置桌子高度&桌子的宽度。我的意思是我只想在执行时将此表设置为整页。

我的代码块如:



Dear all,

Might be this is very simple question which i am going to ask but i did google for the same but i am not satisfied.
I just want to set table height & width of table. I mean i just want set this table to whole page when i execute.
My code block like:

"<table style='width:100%; font-family:Arial; color:Black; size:10px; text-align:left'>" +
                "<tr><td style='font-weight:bold'>" +
            "Greeting For the Day!!!!,<br/><br/>" +
            "</td></tr>" +



但我提到整个桌子的高度。


but where i mention height of whole table.

推荐答案

你好
你可以设置宽度到表使用100%,但高度u不能使用%设置,需要使用px。

所以,首先使用jquery来获取窗口高度或浏览器高度,并通过css代码的高度最终使用cssclass中的css或table标签中的class属性。



http://api.jquery.com/height/ [ ^ ]



http://stackoverflow.com/questions/2407221/how-to-get-the-height-of-the-screen-using-jquery [ ^ ]



EX:



在aspx页面添加这个代码(代码背后)



Hi U can set width to table using "100%" but height u can't set using "%",need to use "px".
So ,first use jquery to get windows height or browser height,and pass that height to css code finally use that css in cssclass or class property in table tag.

http://api.jquery.com/height/[^]

http://stackoverflow.com/questions/2407221/how-to-get-the-height-of-the-screen-using-jquery[^]

EX:

In aspx page add this code(code behind)

.somediv{

height:100%;
}

<script>


document )。ready( function (){
resizeDiv();
});

window .onresize = function (event){
resizeDiv ();
}

function resizeDiv(){
vpw =
(document).ready(function(){ resizeDiv(); }); window.onresize = function(event) { resizeDiv(); } function resizeDiv() { vpw =


window )。width();
vph =
(window).width(); vph =


这篇关于如何设置身高和HTML中的widthof表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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