当前位置:网站首页>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”
边栏推荐
- Use kubernetes resource lock to complete your own ha application
- 如何成为一名高级数字 IC 设计工程师(6-7)数字 IC 验证篇:DEBUG 技巧
- 数字 IC 设计、FPGA 设计秋招笔试题目、答案、解析(2)2021 华为海思(上)
- 如何用项目甘特图,做好项目汇报
- String substitution
- QT basics tutorial: data types and containers
- Digital IC design, FPGA design written examination questions, answers and analysis of autumn move (1) 2022 Ziguang zhanrui (Part 1)
- MySQL详解 --- 聚合与分组
- Necessary technologies for chip manufacturers (1) Introduction
- 网上联系客户经理办理炒股开户安全吗?
猜你喜欢

干货丨微服务架构是什么?有哪些优点和不足?

项目研发,有哪些好用的免费脑图工具软件

HBuilder左侧工具栏不见了

Trigonometric function calculation

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

How to become a senior digital IC Design Engineer (4-5) script: file comparison operation implemented by shell script

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

Interviewer: with the for loop, why do you need foreach??

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

如何用项目甘特图,做好项目汇报
随机推荐
How to become a senior digital IC Design Engineer (4-2) script: file read / write operation realized by Verilog HDL code
2022.02.15
如何用项目甘特图,做好项目汇报
Finally got the byte offer. The 25-year-old inexperienced experience in software testing is written to you who are still confused
CTFHub-Web-密码口令-默认口令
Cross border information station
MySQL详解 --- 聚合与分组
大三下期末考试
[redis] hash type
110. 简易聊天室13:聊天室服务端
Trigonometric function calculation
Set set
数字 IC 设计、FPGA 设计秋招笔试题目、答案、解析(2)2021 华为海思(上)
String segment combination
I have summarized some experiences from the whole process of R & D platform splitting
Blog publishing test 2
MySQL的下载和安装
B1009 irony
SystemVerilog structure (I)
字符串方法练习