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

推荐订阅源

I
InfoQ
C
CERT Recently Published Vulnerability Notes
The Last Watchdog
The Last Watchdog
P
Proofpoint News Feed
D
Darknet – Hacking Tools, Hacker News & Cyber Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
GbyAI
GbyAI
T
Tenable Blog
博客园 - 三生石上(FineUI控件)
P
Privacy & Cybersecurity Law Blog
Simon Willison's Weblog
Simon Willison's Weblog
Jina AI
Jina AI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tor Project blog
博客园_首页
F
Fortinet All Blogs
博客园 - Franky
Latest news
Latest news
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
Scott Helme
Scott Helme
L
LINUX DO - 热门话题
U
Unit 42
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Hugging Face - Blog
Hugging Face - Blog
D
Docker
Project Zero
Project Zero
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
MongoDB | Blog
MongoDB | Blog
F
Full Disclosure
D
DataBreaches.Net
Google DeepMind News
Google DeepMind News
Cisco Talos Blog
Cisco Talos Blog
Y
Y Combinator Blog
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
H
Help Net Security
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
月光博客
月光博客
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Blog — PlanetScale
Blog — PlanetScale
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
Schneier on Security
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed
PCI Perspectives
PCI Perspectives
Cloudbric
Cloudbric
V
Visual Studio Blog
Recorded Future
Recorded Future
人人都是产品经理
人人都是产品经理

鬼影的基地

CVE-2025-61638:Sanitizer::validateAttributes data-XSS 萌娘百科水平越权漏洞 萌娘百科头像魔术字 IP 泄露 萌娘百科评论区 IP 泄露 修复 iPhone 13 iOS 16 Safari 中的 Bug 命名空间 在 CSS 中进行数据类型转换 在 iOS 的 Apple Mail 中添加 QQ邮箱 CodeMirror url() Bug Safari animation Bug 在 macOS 上部署 Viper CSS 像素画的方法
CSS 自适应简单 Table
鬼影233 · 2026-06-02 · via 鬼影的基地

前言

众所周知,Table 由于其不方便换行的固有特性,且常常存在一行大量文本,正在逐渐与现代的自适应布局脱节。Grid 与 Flex 的效果固然不错,但有没有什么方法能将简单的 Table 进行简单的自适应并保持代码(例如 Wikitext)的基本格式以对代码力较差的大众也能看懂?

答案自然是有的,当你去网上搜索便能发现一些使用 attr() 的 CSS 转换,亦或者是用 JS 进行更复杂的转换。

而本篇介绍的便是 attr() 的进阶方法,毕竟每个元素都要设置 data- 值也太烦了……

实例

@media (max-width: 576px) {
	.flextable,
	.flextable > tbody,
	.flextable tr {
		display: block;
	}
	.flextable th {
		display: none;
	}
	.flextable tr {
		margin-block: .5em;
	}
	.flextable td {
		display: list-item;
		text-align: right;
		margin-left: 4em;
	}
	@counter-style flextable-114514 {
		system: fixed;
		suffix: ":";
		symbols: "标题1" "标题2" "标题3";
	}
	.flextable#flextable-114514 {
		list-style: flextable-114514;
	}
	.flextable td::marker {
		font-weight: bolder;
	}
	.flextable td[data-th]::marker {
		content: attr(data-th) ":";
	}
}
标题1 标题2 标题3
内容1 内容2 内容3
内容4 内容5 内容6
内容7 内容8 内容9

简介

此方法仅适用于十分基础的表格,但我想这大概也挺有用的。可惜其中主要的参数 MediaWiki 的纯 CSS / 已过滤的 CSS 并不支持。

思路是将表格转换为有序列表,通过 symbols 统一指定标题。data-th 值可用于特别指定一个标题,虽然感觉没什么用。

这里不对代码进行详细解释,请自行查阅例如 MDN 等相关文档,如果还是看不懂,或许你不该在这里。