jQuery中width(),innerWidth(),outerWidth(),outerWidth(true)

来源:互联网 发布:golang smtp.sendmail 编辑:程序博客网 时间:2024/05/23 01:57
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
div{
background: #fc0;
width: 100px;
height: 100px;
padding: 10px;
border: 10px solid red;
margin: 10px;
}
</style>
<script src="js/jquery-1.12.4.min.js"></script>
<script>
$(function(){
alert($('div').width());              //width
alert($('div').innerWidth());//width+padding
alert($('div').outerWidth());//width+padding+border
alert($('div').outerWidth(true));  //width+padding+border+margin
})
</script>
</head>
<body>
<div></div>
</body>
</html>
0 0
原创粉丝点击