当前位置:网站首页>小知识点随笔记
小知识点随笔记
2022-07-21 23:12:00 【Buliang_C】
1. transform: translate(-50%, -50%);
将会将元素位移自己宽度和高度的-50%
记住transform只能设置一个,下面的transform会覆盖掉上面的。
即使你写的是: 只会执行下面的那行代码,上面的都被覆盖掉了。
transform: translateX(-50%);
transform: translateY(-50%);
2. nth-child 和 nth-of-type
nth-child
按照当前选择的兄弟元素个数来算。
nth-of-type是取当前元素的兄弟元素的第n个,nth-child取的是当前元素的第n个节点的当前元素
nth-of-type
按照类型来计算,如果是class那么碰到不同类型的,单独一类,符合条件的选中。
<style>
div:nth-child(3){
// 取不到了,因为第三个兄弟元素被P给占了,不是div了。
background:#ff0000;
}
div:nth-of-type(3){
// 取到第三个div,因为nth-of-type是按照兄弟节点的类型来取的,不是按照个数。
background:#000000;
}
</style>
<div>
<p>第一个段落。</p>
</div>
<div>
<p>第二个段落。</p>
</div>
<p><b>注释:</b>Internet Explorer 不支持 :nth-child() 选择器。</p>
<div>
<p>第三个段落。</p>
</div>
3. childNodes和children
Node.childNodes 返回包含指定节点的子节点的集合,该集合为即时更新的集合。
Element.children 是一个只读属性,返回 一个Node的子elements ,是一个动态更新的 HTMLCollection 。
4. 当slice遇到undefined
众所周知,Array.prototype.slice(start,end); 选择从给定的 start 参数开始的元素,并在给定的 end 参数处结束,但不包括。返回一个新数组,包含数组中被选中的元素。
let arr = [1,2,3];
arr.slice(0,1); // 将第0个元素切割出来,得到[1];
当start为undefined的时候,则会按照0来计算。跟null一样。
let arr = [1,2,3];
arr.slice(undefined,1); // 将第0个元素切割出来,得到[1];
边栏推荐
- [waiting for insurance] what does waiting for insurance rectification mean? What are the rectification contents?
- leetcode 792. Number of matching subsequences
- 谈谈实施数据治理时常犯的10大错误
- Qt development application debug and release settings
- Simple crud of SSM
- ideal关于 log显示问号且双击无法打不开的解决方法
- 2022/07/19----栈的压入、弹出序列;表示数值的字符串
- 乱七八糟的分析View体系
- One bite of Stream(8)
- pyhton爬取一、二级网站页面,并将爬取的图片信息保存到本地
猜你喜欢
【C】信息管理系统/通讯录通用模板(介绍静态、动态、文件三个版本)
恭贺《创新·赋能》产品创新管理论坛7月16日成功召开
稀土开发者大会|Apache Pulsar Committer 刘德志分享云原生技术变革之路
Privacy-Preserving Generative Deep Neural Networks Support Clinical Data Sharing
Service (LB) and managed pod
谈谈实施数据治理时常犯的10大错误
Privacy-Preserving Generative Deep Neural Networks Support Clinical Data Sharing
Supply chain collaborative management system of pharmaceutical machinery industry: full link digital coverage to realize the visualization of industrial supply chain
One bite of Stream(9)
“新能源+储能“从数字孪生开始,图扑将智慧电力做到极致
随机推荐
【MySQL必知必会】 存储过程 | 游标
下载图片功能,全屏功能,复制功能
2022 ranking list of database audit products - must see!
[QNX Hypervisor 2.2用户手册]8.7 虚拟I/O(VIRTIO)
"Double business success classic" is newly upgraded and launched! Hot summer new products, waiting for a long time to come!
ClickHouse引擎之-MaterializeMYSQL
Different accounts are logged in in different windows of the same browser. When the window is switched, the page refresh account is changed to the last login account
Privacy-Preserving Generative Deep Neural Networks Support Clinical Data Sharing
2022.7.21-----leetcode.814
Applet project summary
How does Siemens PLC in the factory control room collect the production data of multiple production lines in a centralized and wireless way?
如何安装mysql
Common management problems and solutions in automation equipment manufacturing industry
Go list modify element value
2022/07/18------ clockwise printing matrix
[MdSQL]表的增删查改(进阶)
Addition, deletion, query and modification of [mdsql] table (Advanced)
QT uses Google breakpad to capture program crash reports (dump files)
Mysql8 stored procedure generates calendar table and exception handling
v7底部栏fragment