惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Privacy International News Feed
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Jina AI
Jina AI
T
Tailwind CSS Blog
WordPress大学
WordPress大学
Scott Helme
Scott Helme
C
Cybersecurity and Infrastructure Security Agency CISA
博客园 - Franky
C
CERT Recently Published Vulnerability Notes
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
雷峰网
雷峰网
Schneier on Security
Schneier on Security
博客园 - 聂微东
T
Tor Project blog
Hugging Face - Blog
Hugging Face - Blog
博客园 - 司徒正美
AI
AI
T
Troy Hunt's Blog
Security Latest
Security Latest
T
The Blog of Author Tim Ferriss
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
C
Check Point Blog
T
Threat Research - Cisco Blogs
W
WeLiveSecurity
V
Vulnerabilities – Threatpost
Recorded Future
Recorded Future
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Cisco Talos Blog
Cisco Talos Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
Cloudbric
Cloudbric
J
Java Code Geeks
罗磊的独立博客
C
Cyber Attacks, Cyber Crime and Cyber Security
aimingoo的专栏
aimingoo的专栏
L
LangChain Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
P
Privacy & Cybersecurity Law Blog
Google DeepMind News
Google DeepMind News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
L
Lohrmann on Cybersecurity
I
InfoQ
MongoDB | Blog
MongoDB | Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The GitHub Blog
The GitHub Blog
The Hacker News
The Hacker News
H
Help Net Security
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Proofpoint News Feed
N
News and Events Feed by Topic

DaraW

GMTC 北京 2021 小程序开发实践专场所见所想 从一次 Bug 定位来看 Taro H5 的组件实现 浅谈 B 站新 BV 号的设计 复盘:Vue.js 是如何成功的 你可能不知道的 Git React 应用性能优化一例 Thrift RPC Mock 方案探索 前端视频质量监控 前端函数式编程 多说一句再见 《你不知道的JS上卷》阅读小记之setTimeout的this指向问题 ES6实现内部类的写法 IntelliJ IDEA在Linux下字体不正常解决方案 node-thunkify源码阅读笔记 如何监听JS变量的变化 JS实现自定义事件 git用户名莫名其妙变化及挽救措施 记一次前端性能优化实战 将setTimeout函数队列
制作列带有斑马条纹背景的表格
DaraW · 2016-05-16 · via DaraW

在切页面时,遇到了一个有趣的表格,如图所示:

下意识的想到了bootstrap的斑马纹效果table,然而记忆中bs只有行斑马纹效果,至于实现事实上很简单,直接去Github看最终生成的bootstrap.css文件,当前的2321~2323行为:

1
2
3
.table-striped > tbody > tr:nth-of-type(odd) {
background-color: #f9f9f9;
}

事实上这给了我一个很好的思路,借助nth-child()选择器,先对每行的奇数td设定背景,连起来就是奇数列做了特殊背景处理,也就是斑马纹效果,然后再对第一行和最后一行做特殊处理让边角圆润,下面贴上自己的代码(主要提供一个思路,css比较烂,请轻喷==):
html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<table class="account-course-lessons">
<tbody>
<tr>
<td><input type="checkbox"><a href="#">L1</a></td>
<td><input type="checkbox"><a href="#">L2</a></td>
<td><input type="checkbox"><a href="#">L3</a></td>
<td><input type="checkbox"><a href="#">L4</a></td>
</tr>
<tr>
<td><input type="checkbox"><a href="#">L5</a></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>

scss

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
table.account-course-lessons {
width: 600px;
height: 300px;
margin: 1em;
background-color: rgb(221, 221, 221);
border-radius: 10px;
text-align: center;
text-decoration: underline;

tr {
td {
border-bottom: 2px solid rgb(215, 215, 215);
height: 60px;

a {
color: gray;
font-size: 1.5em;
margin: 0 1em;
}
}
}
tr {
td:nth-child(2n+1) {
background-color: rgb(235, 235, 235);
border-bottom: 2px solid rgb(215, 215, 215);
}
}
tr:nth-child(1) {
td:nth-child(2n+1) {
background-color: rgb(235, 235, 235);
border-top: 10px solid transparent;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-radius: 20px 20px 0 0 ;
}
}
tr:nth-last-child(1) {
td:nth-child(2n+1) {
background-color: rgb(235, 235, 235);
border-bottom: 10px solid transparent;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-radius: 0 0 20px 20px ;
}
td {
border-bottom: 0;
}
}
}