开发者

How to specify height in jquery css method

I would like to set height for div element in 开发者_如何学JAVAthe form of percentage. not by pixel wise.

$("#div1").height("200px"); 

so how should I set this in percentage wise?


$("#div1").css("height", "20%");

sets the height to 20% of the element with id div1


you might need to set your body and html tag to 100%.

//css
html, body {
    height: 100%;
}

then just change the px to %

$("#div1").height("20%");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜