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%");
精彩评论