jQuery CSS-jQuery盒子模型
2015-09-25 23:30
627 查看
bootstrap.min.css跟平时的盒子模型不同,bootstrap: width里面包含了border 和 padding
1. css
$(document).ready(function(){
// $("div").css("width","100px");
// $("div").css("height","100px");
// $("div").css("background-color","red");
/* $("div").css({
width: "200px",
height: "200px",
backgroundColor: "red", //backgroundColor, you can not use ;
});*/
$("div").addClass("style1");
$("div").click(function(){
//$(this).addClass("style2");
$(this).removeClass("style1");
$(this).toggleClass("style2");
});
});
2. 盒子模型
<style>
#div{
width: 100px;
height: 100px;
margin: 50px;
padding: 100px;
border: 2px solid black;
background-color: red;
}
</style>
/* height() innerHeight() outHeight() */
$(document).ready(function(){
alert($("#div").height());
alert($("#div").innerHeight());
alert($("#div").outerHeight());
alert($("#div").outerHeight(true));
});
1. css
$(document).ready(function(){
// $("div").css("width","100px");
// $("div").css("height","100px");
// $("div").css("background-color","red");
/* $("div").css({
width: "200px",
height: "200px",
backgroundColor: "red", //backgroundColor, you can not use ;
});*/
$("div").addClass("style1");
$("div").click(function(){
//$(this).addClass("style2");
$(this).removeClass("style1");
$(this).toggleClass("style2");
});
});
2. 盒子模型
<style>
#div{
width: 100px;
height: 100px;
margin: 50px;
padding: 100px;
border: 2px solid black;
background-color: red;
}
</style>
/* height() innerHeight() outHeight() */
$(document).ready(function(){
alert($("#div").height());
alert($("#div").innerHeight());
alert($("#div").outerHeight());
alert($("#div").outerHeight(true));
});
相关文章推荐
- jquery记住登录密码
- jQuery EasyUI API 中文文档 - 消息框(Messager)
- jQuery学习之获取和设置内容以及属性
- jQuery获取Select选择的Text和Value(详细汇总)
- jQuery HTML之捕获、设置、元素添加、元素删除
- 原生js,jquery通过ajax获得后台json数据动态新增页面元素
- jQuery Table2CSV插件(表格转CSV) 完美支持colspan和rowspan
- Qrcode生成二维码普通篇之jquery.qrcode.min.js
- jquery mobaile中textarea根据内容自动调整高度
- jQuery中click()与trigger方法的区别
- Jquery mobile 新手问题总汇
- jquery mobile页面跳转后样式丢失js失效
- JQuery 取值.赋值的基本方法整理
- jquery跨域访问插件
- jQuery效果之隐藏与显示、淡入淡出、滑动、回调
- GridView 排序 jquery.tablesorter
- 3.精通前端系列技术之深入学习Jquery(一)
- jquery的html,text,val
- jQuery源码学习 之 ready与load事件 ---- day4
- IE8浏览器缓存问题导致Ajax的GET请求只能执行一次的解决办法