jQuery的宽度、内宽和外宽、高度、内高和外高有什么区别
16lz
2021-01-22
I wrote some example to see what is the difference, but they display me same results for width and height.
我写了一些例子来看看区别是什么,但是它们显示的宽度和高度都是一样的。
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var div = $('.test');
var width = div.width(); // 200 px
var innerWidth = div.innerWidth(); // 200px
var outerWidth = div.outerWidth(); // 200px
var height = div.height(); // 150 px
var innerHeight = div.innerHeight(); // 150 px
var outerHeight = div.outerHeight(); // 150 px
});
</script>
<style type="text/css">
.test
{
width: 200px;
height: 150px;
background: black;
}
</style>
</head>
<body>
<div class="test"></div>
</body>
</html>
In this example you can see that they output same results. If anyone know what is the difference please show me appropriate answer.
在这个示例中,您可以看到它们输出了相同的结果。如果谁知道有什么区别,请给我适当的回答。
Thanks.
谢谢。
4 个解决方案
#1
213
Did you see these examples? Looks similar to your question.
你看到这些例子了吗?看起来和你的问题很相似。
Working with widths and heights
使用宽度和高度
jQuery - Dimensions
jQuery -维
jQuery: height, width, inner and outer
jQuery:高、宽、内、外
更多相关文章
- 最简单jquery.ajax+php例子(对话框显示文本框输入内容),以小见大
- SprngMVC整合jquery的json 最简单的例子 一看就明白
- 模态的jQuery动态高度宽度
- jquery对json数据进行增删改查的例子
- 当侧面物品具有不同宽度时,保持中间物品居中
- HTML DIV百分比宽度奇奇怪怪的间距产生了?
- 另一个div内的任意宽度的中心div
- 当给出%宽度时,表的主体减少了Head的col 1空间的总空间
- 宽度切换jQuery中的Animate在FireFox中不起作用? [重复]