当前位置:网站首页>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”
边栏推荐
- Necessary technologies for chip manufacturers (1) Introduction
- 【学习笔记】子集和问题
- Understand flex layout in an article
- 字符串长度
- Use kubernetes resource lock to complete your own ha application
- Google Borg论文
- 11 go Foundation: Interface
- What is the Valentine's Day gift given by the operator to the product?
- 基于 RISC-V SoC 的可配置 FFT 系统设计(1)引言
- [redis] list type
猜你喜欢

Koa quick start
![[MySQL practice of high concurrency, high performance and high availability of massive data -9] - transaction concurrency control solutions lbcc and mvcc](/img/62/77c2274db4f92ad1d88901e149251c.jpg)
[MySQL practice of high concurrency, high performance and high availability of massive data -9] - transaction concurrency control solutions lbcc and mvcc

How to use project Gantt chart to make project report
![[redis] set type](/img/97/0a83016e89316849c01072044f2124.png)
[redis] set type

Talk about the copyonwritearraylist of JUC

Koa 快速入門

【Redis】Hash类型

【Redis】SortedSet类型

Ctfhub web password weak password

What is the dry goods microservice architecture? What are the advantages and disadvantages?
随机推荐
2022.02.15
“内窥镜第一股”二闯IPO,去年亏损5个亿,核心产品商业化仍存疑 | IPO速递
Is there any risk in opening an account for Dongfang fortune stock? Is it safe for Dongfang fortune to open an account
Which securities company is the largest and safest? Which securities company has good service
How to become a senior digital IC Design Engineer (4-2) script: file read / write operation realized by Verilog HDL code
B1009 irony
[MySQL practice of high concurrency, high performance and high availability of massive data -9] - transaction concurrency control solutions lbcc and mvcc
基于 RISC-V SoC 的可配置 FFT 系统设计(1)引言
The 10 most commonly used gadgets for waterfall project management can be built and used freely
11 go Foundation: Interface
SystemVerilog-结构体(一)
How to become a senior digital IC Design Engineer (6-5) digital IC Verification: coverage collection
110. simple chat room 13: chat room server
扁平结构转换为树结构
Dialogue with opensea co creation Alex: we still only touch the tip of the iceberg of NFT capability | chain catcher
Blog publishing test 2
[從零開始學習FPGA編程-49]:視野篇 - 芯片是如何被設計出來的?
"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
Smart world 2030
如何成为一名高级数字 IC 设计工程师(6-6)数字 IC 验证篇:系统级仿真