nth-child和nth-of-type的使用案列
HTML:
<div id="footer-f">
<ul class="trajectory">
<li>
<div class="logo" style="vertical-align: middle"><img style="width: 100%;" src="" alt="logo"></div>
<dl>
<dt>小星星</dt>
<dd><img src="img/Distances.png" alt="D"><span>351.7KM</span><img src="img/Altitude.png" alt="A"><span>500M</span>
</dd>
<dd><img src="img/Date.png" alt="D"><span>2016-06-01</span><img src="img/Datesfm.png" alt="D"><span>00:00:00</span><img src="img/Speed.png" alt="D"><span>1.9KM/H</span></dd>
</dl>
<div class="Details" ><img src="img/Details.png" alt="D">
</div>
</li>
</ul>
</div> CSS:
#footer-f {
overflow: scroll;
background-color: #ffffff;
height: 77%;
}
.trajectory > li {
overflow:hidden ;
height: 72px;
position: relative;
}
.trajectory > li:first-child {
height: 105px;
}
.trajectory > li > div, .trajectory > li > dl {
float: left;
box-sizing: border-box;
}
.trajectory > li > div:nth-child(1) {
width: 75px;
}
.trajectory > li > dl {
width: 65%;
position: absolute;
left: 85px;
}
.trajectory > li > dl > dd:nth-child(1) {
margin-top: 6px;
}
.trajectory > li > dl > dd {
position: relative;
}
.trajectory > li > dl > dd img {
width: 7px;
}
.trajectory > li > dl > dd:first-of-type span:last-child{
position: absolute;
left: 43%;
}
.trajectory > li > dl > dd:last-of-type span:last-child{
position: absolute;
left: 73%;
}
.trajectory > li > dl > dd:last-of-type span:nth-of-type(2){
position: absolute;
l
eft: 43%;
}
.trajectory > li > dl > dd:first-of-type img:last-of-type{
position: absolute;
bottom: 33%;
left:41%;
}
.trajectory > li > dl > dd:last-of-type img:last-of-type{
position: absolute;
bottom: 33%;
left:71%;
}
.trajectory > li > dl > dd:last-of-type img:nth-of-type(even){
position: absolute;
bottom: 33%;
left:41%;
}
.trajectory > li > div:nth-child(3) {
width: 45px;
}
关于nth-child和:nth-of-type的区别 : :nth-child可以选择父元素下的字元素,:nth-of-type也可以。但是它们到底有什么区别呢? 其实区别很简单::nth-of-type为什么要叫:nth-of-type?因为它是以"type"来区分的。也就是说:ele:nth-of-type(n)是指父元素下第n个ele元素, 而ele:nth-child(n)是指父元素下第n个元素且这个元素为ele,若不是,则选择失败。
nth-child和nth-of-type的使用案列的更多相关文章
- [Swift]LeetCode400. 第N个数字 | Nth Digit
Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note:n is ...
- Sass函数:列表函数nth
语法: nth($list,$n) nth() 函数用来指定列表中某个位置的值.不过在 Sass 中,nth() 函数和其他语言不同,1 是指列表中的第一个标签值,2 是指列给中的第二个标签值,依此类 ...
- Oracle使用%type类型的变量输出结果
使用%type关键字可以声明一个与指定列名称相同的数据类型,他通常紧跟在指定列名的后面. 使用%type的2个好处: 1.用户不必查看表中各个列的数据类型,就可以确保所定义的变量能够存储检索的数据. ...
- C# - 系统类 - Type类
Type类 ns:System Type类封装类型 它的实例提供一个特定类型的数据和函数成员的信息 可以使用Type类实例来调用类型的成员 一般将Type类用于反射 Type类的静态字段如下 Empt ...
- 使用Atlas进行元数据管理之Type(类型)
背景:笔者和团队的小伙伴近期在进行数据治理/元数据管理方向的探索, 在接下来的系列文章中, 会陆续与读者们进行分享在此过程中踩过的坑和收获. 元数据管理系列文章: [0] - 使用Atlas进行元数据 ...
- mysql中explain的type的解释
type -- 连接类型 type意味着类型,这里的type官方全称是“join type”,意思是“连接类型”,这样很容易给人一种错觉觉得必须需要俩个表以上才有连接类型.事实上这里的连接类型并非字面 ...
- python 中的object与type的关系
object 和 type的关系很像鸡和蛋的关系,先有object还是先有type没法说,obejct和type是共生的关系,必须同时出现的. 在看下去之前,也要请先明白,在Python里面,所有的东 ...
- Python面试题之Python中type和object的关系
知乎上看到的提问: 两个是互为实例的关系,但不是互为子类的关系,只有type是object的子类,反之则不成立. 大牛说两者是蛋生鸡鸡生蛋的关系,但我还是不明白,有懂的麻烦解释一下, 希望不要给出外文 ...
- mysql explain的type的
导语 很多情况下,有很多人用各种select语句查询到了他们想要的数据后,往往便以为工作圆满结束了.这些事情往往发生在一些学生亦或刚入职场但之前又没有很好数据库基础的小白身上,但所谓闻道有先后,只要我 ...
- Selenium Xpath Tutorials - Identifying xpath for element with examples to use in selenium
Xpath in selenium is close to must required. XPath is element locator and you need to provide xpath ...
随机推荐
- 廖雪峰Java10加密与安全-1数据安全-1加密与安全概念
数据安全 防窃听 防篡改 防伪造 古代加密方式: 移位密码:HELLO =>IFMMP 替代密码:HELLO=>p12,5,3 现代加密方式: 建立在严格的数学理论基础上 密码学逐渐发展成 ...
- 【codeforces 507E】Breaking Good
[题目链接]:https://vjudge.net/contest/164884#problem/D [题意] 给你一张图; 图中有些路是完好的;但有些路还没修好; 先不管路有没有修好; 问你从起点到 ...
- C++与Matlab混合编程之:矩阵数据结构
项目需要将matlab代码写成C++,准备用opencv.opencv中矩阵的存储与matlab有所不同,应注意以下问题: 1.matlab中矩阵是按照列优先存储的.对于n0*n1*...*nn维的矩 ...
- js/jquery判断一个对象是否为空
一.js判断一个对象是否为空对象 1)通过JSON自带的.stringify方法来判断 //JSON自带的stringify方法,将json转成json字符串 var c = {}; if(JSON. ...
- 如何设置td中溢出内容的隐藏显示
<style type="text/css"> table { table-layout:fixed; } td { overflow:hidden; word-bre ...
- 2019-2019-2-20175332-实验三《敏捷开发与XP实践》实验报告
一.编码标准 题目要求: 在IDEA中使用工具(Code->Reformate Code)把下面代码重新格式化,再研究一下Code菜单,找出一项让自己感觉最好用的功能. 实验步骤 1.安装ali ...
- boxFilter in opencv
, -),bool normalize=true,int borderType=BORDER_DEFAULT) Smoothes image using box filter Parameters: ...
- MyBatis框架的文件配置
第一步:log4j.properties的配置 原因:Mybatis的日志输出是依赖与log4j的,所以必须要配置 # Global logging configuration log4j.rootL ...
- Redis使用:聚合类型为空时,会自动被Redis删除
项目中使用Redis来记录用户的上线和下线信息,其中用到了集合(sets)类型,某用户上线时,向sets中添加数据,下线时将相应数据从sets中删除,考虑当该用户的所有实例都下线时,需要将sets删除 ...
- 完美解决IE8不支持margin auto问题
不用js,超级简单,完美支持. body下的整个container .container { overflow: hidden; margin: 0px auto; text-align: cente ...