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 ...
随机推荐
- 关于js的闭包和复制对象
一.有关js的闭包 1.概念:所谓的闭包,就是指的两个作用域,其中内层作用于可以访问外层作用域的函数的现象 2.简单应用 for(var i = 0;i< lis.lenth;i++){ (fu ...
- poj 2288
传送门 解题思路 状压dp,记录路径条数,dp[S][i][j]表示状态为S,前一个点是i,再前一个点是j的最大值,然后在开个一样的数组记录方案数,时间复杂度O(2^n*n^2),注意要用long l ...
- 基于MaxCompute打造轻盈的人人车移动端数据平台
摘要: 2019年1月18日,由阿里巴巴MaxCompute开发者社区和阿里云栖社区联合主办的“阿里云栖开发者沙龙大数据技术专场”走近北京联合大学,本次技术沙龙上,人人车大数据平台负责人吴水永从人人车 ...
- 洛谷P3296 刺客信条
题意: 给你一棵树,有两组01权值a[]和b[].n <= 700 你要构造一个自己到自己的映射,使得整棵树的形态不变,且映射后的a[]和映射之前的b[]中不同元素尽量少. 解: 发现这个整棵树 ...
- Hibernate - HHH000352: Unable to release batch statement
这是hibernate的一个bug,具体看https://hibernate.atlassian.net/browse/HHH-11732?attachmentViewMode=list When u ...
- php获取数据转换成json格式
<?php header("content-type:text/html;charset=utf-8"); $con=mysql_connect("localhos ...
- 手机前端开发调试利器-vConsole
最近因为做抽奖页面,在android上可以使用手机连上电脑后用chrome浏览器chrome://inspect进行页面探测,但是ios中的页面就不能这样探测 在网上搜索后发现此插件,大大解决了问题 ...
- didFailWithError: Error Domain=kCLErrorDomain Code=0 “The operation couldn’t be completed. (kCLError
This error also occurs if you have Scheme/Edit Scheme/Options/Allow Location Simulation checked but ...
- Hackerrank--Team Formation
题目链接 For an upcoming programming contest, Roy is forming some teams from the n students of his unive ...
- python 基础(while 循环、格式化输出、运算符、编码初识)
while循环 break 终止当前循环 count = 1 while count < 3: print(count) count += 1 break # while循环中一旦代码执行到br ...