当前位置:网站首页>Table implements alternative adaptation through pseudo classes
Table implements alternative adaptation through pseudo classes
2022-06-29 02:22:00 【A fake front man】
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style> * {
padding: 0; margin: 0; box-sizing: border-box; } @media screen and (min-width: 800px) {
table {
width: 100vw; border: 1px solid black; border-collapse: collapse; } tr {
border-bottom: 1px solid black; } td {
text-align: center; } } @media screen and (max-width: 800px) {
table {
border: 0; width: 100vw; } table thead {
display: none; } table tr {
display:block; margin-bottom: 20px; } table td {
border-bottom: 1px solid #ddd; /* position: relative; */ /* display: block; */ /* text-align: right; */ display: flex; justify-content: space-between; } table td::before {
/* position: absolute; */ /* left: 10px; */ content: attr(data-label); font-weight: 600; } } </style>
</head>
<body>
<table>
<caption>Lorem ipsum !</caption>
<thead>
<tr>
<th>Account</th>
<th>Due Date</th>
<th>Amount</th>
<th>Period</th>
</tr>
</thead>
<tbody>
<tr>
<td data-label="Account">Visa -
3412</td>
<td data-label="Due Date">04/01/2016</td>
<td data-label="Amount">$1,190</td>
<td data-label="Period">03/01/2016 - 03/31/2016</td>
</tr>
<tr>
<td data-label="Account">Visa - 3412</td>
<td data-label="Due Date">04/02/2016</td>
<td data-label="Amount">$1,190</td>
<td data-label="Period">03/01/2016 - 03/31/2016</td>
</tr>
<tr>
<td data-label="Account">Visa - 3412</td>
<td data-label="Due Date">04/02/2016</td>
<td data-label="Amount">$1,190</td>
<td data-label="Period">03/01/2016 - 03/31/2016</td>
</tr>
</tbody>
</table>
</body>
</html>

Main implementation method Media query + With the help of pseudo elements and their properties , Display header information
here When he meets the screen smaller than 800 when Hide header Then break it td And through the content Realization Header filling
here , Our core knowledge point is to use the pseudo element of the element to be able to content In the attribute , Read it HTML Attribute contents within the element , And show the knowledge points .
Suppose a HTML Labels are defined as :
Then the div If the corresponding pseudo element is set content: attr(data-msg) , You can read data-msg Value , amount to content:“ABC”
边栏推荐
- 大三下期末考试
- How to become a senior digital IC Design Engineer (4-2) script: file read / write operation realized by Verilog HDL code
- Trigonometric function calculation
- 11-Go基础:接口
- MySQL的下载和安装
- To apply for a test engineer after years, the resume with high scores should be written like this
- Necessary technologies for chip manufacturers (1) Introduction
- 【网络通信学习笔记】Socket.IO的搭建和部署
- 字符串输出
- String method exercise
猜你喜欢

Dialogue with opensea co creation Alex: we still only touch the tip of the iceberg of NFT capability | chain catcher

目标检测——ADAS实战

Ctfhub web SQL injection - integer injection
![[redis] get to know redis for the first time](/img/02/3c6a7f6ea8c563386a4cd458024728.png)
[redis] get to know redis for the first time

Zhongyi technology resumed the review status of the gem IPO, and xuxiaofei no longer acted as a practicing lawyer
![[redis] sortedset type](/img/7f/f5f1aa603c8994b669d52a435fed7e.png)
[redis] sortedset type

CTFHub-Web-SQL注入-整数型注入

"The first share of endoscope" broke into IPO two times. Last year, it lost 500million yuan. The commercialization of core products is still in doubt | IPO Express

Live broadcast preview | can SQL also play industrial machine learning? Mlops meetup V3 takes you to the bottom!

Differences between web testing and app testing
随机推荐
table通过伪类实现 另类自适应
利用kubernetes資源鎖完成自己的HA應用
okcc呼叫中心的计费方式哪个最好
【Redis】SortedSet类型
The left toolbar of hbuilder is missing
Is there any risk in opening an account for Dongfang fortune stock? Is it safe for Dongfang fortune to open an account
计算矩形面积
Qt基础教程:QStringList
"The first share of endoscope" broke into IPO two times. Last year, it lost 500million yuan. The commercialization of core products is still in doubt | IPO Express
Temperature conversion II
【Redis】List类型
字符串方法练习
瀑布型项目管理最常用的10个小工具,可以自由搭建使用
Flex application: realize two rows and five columns of data, self-adaptive
Necessary technologies for chip manufacturers (1) Introduction
如何成为一名高级数字 IC 设计工程师(6-5)数字 IC 验证篇:覆盖率收集
HBuilder左侧工具栏不见了
MySQL的下载和安装
Live broadcast preview | can SQL also play industrial machine learning? Mlops meetup V3 takes you to the bottom!
在按钮禁用时消除hover效果