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 ...
随机推荐
- Django项目:CRM(客户关系管理系统)--77--67PerfectCRM实现CRM课程出勤排名
# classtop_urls.py # ————————64PerfectCRM实现CRM课程排名详情———————— from django.conf.urls import url from b ...
- vue 基本知识
1,内置事件对象event 原生JS事件中是直接通过传入 e 或者 event 就可以获取,但在vue中要传入 $event 才可以获取到内置事件对象 <body> <button ...
- 166 链表倒数第n个结点
原题网址:https://www.lintcode.com/problem/nth-to-last-node-in-list/description 描述 找到单链表倒数第n个节点,保证链表中节点的最 ...
- pycharm professional 2019版长效激活
PyCharm是一种Python IDE,带有一整套可以帮助用户在使用Python语言开发时提高其效率的工具,比如调试.语法高亮.Project管理.代码跳转.智能提示.自动完成.单元测试.版本控制. ...
- Hadoop IO 特性详解(2)【文件校验】
(本文引用了microheart,ggjucheng的一些资料,在此感谢.charles觉得知识无价,开源共享无价) 这一次我们接着分析文件IO校验的相关代码,看看最底层是如何实现这种大数据集的文件校 ...
- TZ_06_SpringMVC_传统文件上传和SpringMVC文件上传方式
1.传统文件上传方式 <!-- 文件上传需要的jar --> <dependency> <groupId>commons-fileupload</groupI ...
- js中定义变量之②var let const的区别
var 上一篇文章有讲过,是js定义变量的关键词. 但是在es6中,新添加了两个关键词,用于变量声明的关键词:let 和const 接下来就说一下var let 和const的区别: 首先说var 用 ...
- 备忘 ubuntu ip 及 dns 的坑
以前都用 ubuntu 16.04 现在用 18.04 遇到几个恶心的事,现在解决了,记录下来. 1. 设置 DNS , DNS 设置老是不对,最后发现问题老版本 ubuntu 17.10以下 ...
- 通信网络 ccf
试题编号: 201709-4 试题名称: 通信网络 时间限制: 1.0s 内存限制: 256.0MB 问题描述: 问题描述 某国的军队由N个部门组成,为了提高安全性,部门之间建立了M条通路,每条通路只 ...
- 移动端“响应式布局”’--rem
使用目的:为了让移动设计稿在大部分的移动设备上看起来有一致的展示效果,我们使用rem的像素单位. 方法一: 1.在页面引入js,获取屏幕大小,更新rem基准. (function () { var c ...