当前位置:网站首页>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”
边栏推荐
- 11-Go基础:接口
- 计算矩形面积
- What is the dry goods microservice architecture? What are the advantages and disadvantages?
- 大智慧手机股票开户哪个券商更安全更方便?
- How to become a senior digital IC Design Engineer (6-4) digital IC Verification: test point decomposition
- 扁平结构转换为树结构
- 数字 IC 设计、FPGA 设计秋招笔试题目、答案、解析(1)2022 紫光展锐(上)
- Trigonometric function calculation
- Learning Tai Chi Maker - mqtt Chapter II (IX) test of this chapter
- Junior final exam
猜你喜欢

对补wasm环境的一些测试

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

CTFHub-Web-密码口令-弱口令

SAP ui5 beginner tutorial 22 - development and use of filter

HBuilder左侧工具栏不见了

Understand flex layout in an article

SystemVerilog-结构体(一)
![[redis] sortedset type](/img/7f/f5f1aa603c8994b669d52a435fed7e.png)
[redis] sortedset type

Koa 快速入门

Crawler exercise (IV) -- IP address problem
随机推荐
MySQL详解 --- 聚合与分组
Chrome browser close update Popup
The left toolbar of hbuilder is missing
Blog publishing test 2
如何用项目甘特图,做好项目汇报
SystemVerilog-结构体(一)
Which brokerage is safer and more convenient to open an account for compass mobile stock?
e.target与e.currentTarget的区别
瀑布型项目管理最常用的10个小工具,可以自由搭建使用
How to become a senior digital IC Design Engineer (6-5) digital IC Verification: coverage collection
The 10 most commonly used gadgets for waterfall project management can be built and used freely
Temperature conversion II
[redis] set type
Differences between web testing and app testing
利用kubernetes资源锁完成自己的HA应用
Blog publishing test 3
字符串属性练习
【Redis】List类型
[redis] get to know redis for the first time
I have summarized some experiences from the whole process of R & D platform splitting