当前位置:网站首页>DOM系列之 offset 系列
DOM系列之 offset 系列
2022-07-31 00:35:00 【老__L】
1、offset系列
offset 翻译过来就是偏移量, 我们使用 offset系列相关属性可以动态的得到该元素的位置(偏移)、大小等。
2、offset系列的属性
3、描述
1.获得元素距离带有定位父元素的位置
2.获得元素自身的大小(宽度高度)
3.注意:返回的数值都不带单位
4、offset 与 style 区别
4.1、offset
- offset 可以得到任意样式表中的样式值
- offset 系列获得的数值是没有单位的
- offsetWidth 包含padding+border+width
- offsetWidth 等属性是只读属性,只能获取不能赋值
- 所以,我们想要获取元素大小位置,用 offset 更合适
4.2、style
- style 只能得到行内样式表中的样式值
- style.width 获得的是带有单位的字符串
- style.width 获得不包含 padding 和 border 的值
- style.width 是可读写属性,可以获取也可以赋值
- 所以,我们想要给元素更改值,则需要用style改变
后记
如果你感觉文章不咋地
//(ㄒoㄒ)//
,就在评论处留言,作者继续改进;o_O???
如果你觉得该文章有一点点用处,可以给作者点个赞;\\*^o^*//
如果你想要和作者一起进步,可以微信扫描二维码,关注前端老L;~~~///(^v^)\\\~~~
谢谢各位读者们啦(^_^)∠※
!!!
边栏推荐
- [Deep learning] Detailed explanation of Transformer model
- Error occurred while trying to proxy request项目突然起不来了
- How to solve types joiplay simulator does not support this game
- Shell programming of conditional statements
- IOT cross-platform component design scheme
- unity2D横版游戏教程4-物品收集以及物理材质
- 【愚公系列】2022年07月 Go教学课程 013-常量、指针
- MySQL triggers
- Adding, deleting, modifying and checking the foundation of MySQL
- Restricted character bypass
猜你喜欢
binglog log tracking: data backup and backup tracking
场景之多数据源查询及数据下载问题
software development design process
Go 学习笔记(84)— Go 项目目录结构
[In-depth and easy-to-follow FPGA learning 13---------Test case design 1]
[C language course design] C language campus card management system
firewalld
MySQL database (basic)
从两个易错的笔试题深入理解自增运算符
作业:iptables防止nmap扫描以及binlog
随机推荐
A complete guide to avoiding pitfalls for the time-date type "yyyy-MM-dd HHmmss" in ES
[In-depth and easy-to-follow FPGA learning 14----------Test case design 2]
限制字符绕过
【唐宇迪 深度学习-3D点云实战系列】学习笔记
Steven Giesel recently published a 5-part series documenting his first experience building an application with the Uno Platform.
C language force buckles the rotating image of the 48th question.auxiliary array
WMware Tools安装失败segmentation fault解决方法
消息队列存储消息数据的MySQL表设计
SereTOD2022 Track2 Code Analysis - Task-based Dialogue Systems Challenge for Semi-Supervised and Reinforcement Learning
MySQL triggers
encrypted transmission process
Oracle一个诡异的临时表空间不足的问题
MySQL数据库(基础)
PHP图片添加文字水印
In-depth understanding of the auto-increment operator from two error-prone written test questions
论文理解:“Designing and training of a dual CNN for image denoising“
什么是Promise?Promise的原理是什么?Promise怎么用?
How to ensure the consistency of database and cache data?
DATA AI Summit 2022提及到的对 aggregate 的优化
SWM32 Series Tutorial 6 - Systick and PWM