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 ...
随机推荐
- vue.js_08_vue-组件的定义
1.vue组件常用定义方式 <body> <div id="app"> <!--1.3使用组件--> <mycom1></my ...
- Python导出DBF文件到Excel的方法
Python导出DBF文件到Excel的方法 这篇文章主要介绍了Python导出DBF文件到Excel的方法,实例分析了Python基于win32com模块实现文件导出与转换的相关技巧,分享给大家供大 ...
- Linq之Sum用法新体会
1.简单应用,求数组的和,示例: , , , , , , , , , }; double numSum = numbers.Sum(); Console.WriteLine("The sum ...
- 常见Idea插件
一.Maven Helper Maven Helper用来查找和排除Jar包冲突的依赖关系. 安装: 打开Idea的Settings→Plugins→在输入框中输入“maven helper”→点击I ...
- C++类中的枚举类型
在看effective c++的时候,其中第二条边指出.尽量使用const ,enum代替define.在写程序的时候,需要入参为设备类型,第一反应是枚举一个设备类型,并以名字命名.但是有一个问题挺困 ...
- Sql 竖表转横表
) set @sql='select t3.BID,t5.UnitName,Sort,UnitTypeSort' select @sql=@sql+' , max(case t4.id when '' ...
- bzoj 1179 [Apio2009]Atm——SCC缩点+spfa
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1179 显然SCC缩点. 然后准备倒着拓扑序推到st,结果WA. 听TJ说dj求最长路会发生不 ...
- SSM2-搭建maven常见的错误以及解决方法
1.项目中的jdk版本电脑自带的jdk版本不一致 mavne-parent 的pom.xml文件 <!-- java编译插件 --> <plugin> <groupId& ...
- PHP--时间格式处理
Ymd格式转Y-m-d或转成时间戳将Ymd格式如19930811转成1993-08-11格式 date('Y-m-d',strtotime('19930811') 将Ymd格式如19930811转成时 ...
- vue多页面项目配置
全局配置 打开 ~\build\webpack.base.conf.js ,找到entry,添加多入口 entry: { main: './src/main.js', main2: './src/ma ...