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 ...
随机推荐
- Spriongboot+quartz定时任务
y需求: 需要一个定时任务,比如 2019-5-10 10:00 执行一次期初库存推送的功能~ Spring自带的@Schedule() 的cron表达式不支持年份,所以考虑一下quartz定时任 ...
- Django项目:CMDB(服务器硬件资产自动采集系统)--08--06CMDB测试Linux系统采集硬件数据的命令03
https://www.virtualbox.org/wiki/Downloads https://mirrors.aliyun.com/centos/7/isos/x86_64/ http://ww ...
- R语言建立回归分析,并利用VIF查看共线性问题的例子
R语言建立回归分析,并利用VIF查看共线性问题的例子 使用R对内置longley数据集进行回归分析,如果以GNP.deflator作为因变量y,问这个数据集是否存在多重共线性问题?应该选择哪些变量参与 ...
- mysql 索引优化,不走索引的原因
1.WHERE字句的查询条件里有不等于号(WHERE column!=…),MYSQL将无法使用索引 2.类似地,如果WHERE字句的查询条件里使用了函数(如:WHERE DAY(column)=…) ...
- MYSQL数据库练习题操作(select)大全
1.创建表 表一:student学生use) .create table student( sno ) primary key not null comment'学号(主码)', sname ) no ...
- 【MFC】MFC文本框中显示浮点数
CString strNumber; strNumber.Format("%0.2f",tim.getTimeMilli()); SetDlgItemText(IDC_TIME_U ...
- 解读Python中 locals() 和 globals() 内置函数
首先globals() 和 locals() 是作用于作用域下的内置函数,所以我将它们分为作用域类型的内置函数 1.作用域相关: 1)globals() # 返回全局作用域中的所有名字 2)local ...
- Java爬虫的实现
距离上一次写爬虫还是几年前了,那时候一直使用的是httpclient. 由于最近的项目又需要使用到爬虫,因此又重新查询了一些爬虫相关的框架,其中最合适的是WebMagic 官方文档:https://g ...
- GULP入门之API(二)
GULP的API gulp.src(globs[, options]) 输出(Emits)符合所提供的匹配模式(glob)或者匹配模式的数组(array of globs)的文件. 将返回一个 Vin ...
- Liferay 7:Liferay DXP全套教程内附源码
分享是美德 都是英文教程,有不明白的问题可以随时咨询我. http://www.javasavvy.com/liferay-7-hooks-tutorials/