获取div的高度 [英] Getting the height of a div

查看:112
本文介绍了获取div的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<span style="width:100%" id="learning_menu"><div id="aLM" style="width:100%;height:100%">test | test | test</div></span>

上面的代码是我当前的HTML。我将使用jQuery使内部div缩小和增长。我不知道如何获得跨度/ div的高度。我不打算在CSS中设置一个具体的值,因为它可以根据浏览器的不同而改变。因此,我的JavaScript(style.height)总是返回0。

The code above is the current HTML that I have. I'll be making the inner "div" shrink-and-grow using jQuery. I can't figure out how to get the height of the span/div though. I'm not going to set a specific value in CSS because it could change depending on the browser. Because of this, my JavaScript (style.height) always returns 0.

任何想法?

推荐答案

$(#learning_menu)height()将返回span的高度

$("#learning_menu").height() will return the span's height

这篇关于获取div的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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