标签:style blog io ar color sp java on div
浏览器的盒子模型分为两类,一类为标准的w3c盒子模型,另一类为IE盒子模型,两者区别为在Width和Height这两个属性值中是否包含padding和border的值,w3c盒子模型不包含,IE盒子模型则包含,而在jQuery 中,可以通过$.support.boxModel
对象返回的值,检测浏览器是否属于标准的w3c盒子模型。
<body> <div id="divtest"> <div class="title"> <span class="fl">检测是否是盒子模型</span> </div> <div class="content"></div> </div> <script type="text/javascript"> $(function () { var strTmp = "您打开的页面是:"; if ($.support.boxModel) { //是W3C盒子模型 strTmp += "W3C盒子模型"; } else { //是IE盒子模型 strTmp += "IE盒子模型"; } $(".content").html(strTmp); }); </script> </body>
标签:style blog io ar color sp java on div
原文地址:http://www.cnblogs.com/boyzi/p/4125593.html