当前位置: 动力学知识库 > 问答 > 编程问答 >

how to sepcify height in jquery css method

问题描述:

I would like to set height for div element in the form of percentage. not by pixel wise.

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

so how should i set this in percentage wise?

网友答案:

solution here http://jsfiddle.net/EmmsD/

网友答案:
$("#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%");
分享给朋友:
您可能感兴趣的文章:
随机阅读: