当前位置:网站首页>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”
边栏推荐
- 扁平结构转换为树结构
- 如何用项目甘特图,做好项目汇报
- The linkedhashset set makes the elements orderly without repetition
- “内窥镜第一股”二闯IPO,去年亏损5个亿,核心产品商业化仍存疑 | IPO速递
- Qt基础教程:数据类型与容器
- [high concurrency, high performance and high availability of massive data MySQL practice-10] - Implementation of mvcc in InnoDB
- B1009 irony
- 【Redis】初识 Redis
- 目标检测——ADAS实战
- Flex application: realize two rows and five columns of data, self-adaptive
猜你喜欢

HBuilder左侧工具栏不见了

How to become a senior digital IC Design Engineer (4-2) script: file read / write operation realized by Verilog HDL code

OpenResty 使用介绍

What is the dry goods microservice architecture? What are the advantages and disadvantages?

To apply for a test engineer after years, the resume with high scores should be written like this
![[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

Koa 快速入門

I have summarized some experiences from the whole process of R & D platform splitting

Configurable FFT system design based on risc-v SOC (1) Introduction

"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
随机推荐
【Redis】数据介绍 & 通用命令 & String类型
大三下期末考試
SystemVerilog-结构体(一)
How to become a senior digital IC Design Engineer (4-3)
What is the Valentine's Day gift given by the operator to the product?
[redis] get to know redis for the first time
OpenResty 使用介绍
指南针手机股票开户哪个券商更安全更方便?
okcc呼叫中心的计费方式哪个最好
Koa 快速入門
HBuilder左侧工具栏不见了
组合数据类型之元组小练习
Which securities company is the largest and safest? Which securities company has good service
How to become a senior digital IC Design Engineer (3-5) tools: Spyglass Technology
Dialogue with opensea co creation Alex: we still only touch the tip of the iceberg of NFT capability | chain catcher
Qt基础教程:数据类型与容器
table通过伪类实现 另类自适应
【网络通信学习笔记】Socket.IO的搭建和部署
I'd like to ask you, where can I open an account in Zhongshan? Is it safe to open an account online?
利用kubernetes資源鎖完成自己的HA應用