js style属性
来源:互联网 发布:freertos源码详解 编辑:程序博客网 时间:2024/06/06 07:28
<!DOCTYPE html><html><head lang="en"> <meta charset="UTF-8"> <title></title> <style> .box { border: 10px solid #000; } </style></head><body><div class="box" style="width: 100px;height: 100px;background-color: pink;">我爱你中国</div><script> var box = document.getElementsByTagName("div")[0]; // 1.样式少的时候使用 console.log(box.style.backgroundColor); // 2.style是对象 console.log(box.style); console.log(typeof box.style); // 3.值是字符串,没有设置值是“”; console.log(box.style.lineHeight); console.log(box.style.border); // 4.命名规则,驼峰命名。和css不一样 console.log(box.style.backgroundColor); // 5.设置了类样式不能获取。(只和行内式交互,和内嵌和外链无关) console.log(typeof box.className); // 6.box.style.cssText = “字符串形式的样式”; console.log(box.style.cssText); box.style.cssText = "width: 200px; height: 200px; background-color: red;line-height:200px;text-align:center;"</script></body></html>
0 0
- JS中style属性
- JS中style属性
- JS中style属性
- JS中style属性
- JS中style属性
- JS 操作style属性
- js style属性
- js style属性
- js 分浏览器设置style属性
- js改变input里的属性 style
- js获取非style的css属性
- Style[属性]
- style属性
- 使用js获得html控件的style属性内容
- Firefox和IE的JS兼容性:设置元素style属性
- CSS和JS标签style属性对照表
- CSS和JS标签style属性对照表
- CSS和JS标签style属性对照表
- 对象的三大特性(封装、继承、多态)之------继承性 + 覆写
- 关于编程中的无穷大的一些事
- pci_alloc_consistent 配合mmap
- BOM对象--类似页面左右两侧的广告
- 孤儿进程与僵尸进程[总结]
- js style属性
- 我眼中的Window创建/添加/删除/更新过程
- No row with the given identifier exists 解决方法
- Spring容器、Bean配置信息。Bean实现类及应用程序的关系
- sql 语句注意点
- Javascript 知识与经验(二)—— 基本对象类型
- 门描述符
- android-topeka学习笔记(一)-----一些不知道的属性
- ios弹出框