width和height不包括内边距、边框或外边距
来源:互联网 发布:淘宝破损补寄 编辑:程序博客网 时间:2024/06/11 12:57
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("button").click(function(){
var txt="";
txt+="Width of div: " + $("#div1").width() + "</br>";
txt+="Height of div: " + $("#div1").height();
$("#div1").html(txt);
});
});
</script>
</head>
<body>
<div id="div1" style="height:100px;width:300px;padding:10px;margin:3px;border:1px solid blue;background-color:lightblue;"></div>
<br>
<button>显示 div 的尺寸</button>
<p>width() - 返回元素的宽度。</p>
<p>height() - 返回元素的高度。</p>
</body>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("button").click(function(){
var txt="";
txt+="Width of div: " + $("#div1").width() + "</br>";
txt+="Height of div: " + $("#div1").height();
$("#div1").html(txt);
});
});
</script>
</head>
<body>
<div id="div1" style="height:100px;width:300px;padding:10px;margin:3px;border:1px solid blue;background-color:lightblue;"></div>
<br>
<button>显示 div 的尺寸</button>
<p>width() - 返回元素的宽度。</p>
<p>height() - 返回元素的高度。</p>
</body>
</html>
- width和height不包括内边距、边框或外边距
- 内边距、边框和外边距
- 内边距、边框和外边距的关系
- 8.内边距、边框和外边距
- css 内边距 外边距 边框
- 边框 内边距及外边距
- CSS学习笔记8-内边距、边框和外边距
- CSS学习笔记:内边距、边框和外边距
- 盒模型、内外边距和边框
- 外边距,边框,填充
- 边框 内外边距
- 前端开发中padding与边框是否包含进height和width的情况
- 内边距和外边距
- 外边距和内边距
- 内边距和外边距
- width和height使用规范
- Screen.Width 和 Screen.Height
- jQuery获取元素宽高(内边距、边框和外边距)
- Qt自动生成moc文件
- JavaScript弹出框
- Java中List和ArrayList的区别
- spring framework源码下载并导入eclipse
- uva 10815
- width和height不包括内边距、边框或外边距
- Java 2, JDK 1.4
- NYOJ 277题 车牌号
- Eclipse开发auto之dao层自动gen生成
- 【HDOJ】1164 -> Eddy's research I
- Javassist学习总结
- 通过NSTask用Cocoa执行perl脚本
- ORA-01652无法扩展temp表空间段
- FreeMarker集合(List、Map)