【发布时间】:2021-09-22 15:01:13
【问题描述】:
我正在创建一个存储用户数据的项目...
我使用了表格格式, 我想为所有设备(移动设备、标签、笔记本电脑)保持相同的布局。 我不想要移动和标签布局(响应性)。
对于所有查看器,它应该是笔记本电脑/PC 类型的布局(移动和标签查看器也可以)
你的帮助对我有很大帮助...
* {
margin: 0;
padding: 0;
box-sizing: border-box
}
body,
html {
height: 100%;
font-family: sans-serif
}
a {
margin: 0;
transition: all .4s;
-webkit-transition: all .4s;
-o-transition: all .4s;
-moz-transition: all .4s
}
a:focus {
outline: 0 !important
}
a:hover {
text-decoration: none
}
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 0
}
p {
margin: 0
}
li,
ul {
margin: 0;
list-style-type: none
}
input {
display: block;
outline: 0;
border: none !important
}
textarea {
display: block;
outline: 0
}
input:focus,
textarea:focus {
border-color: transparent !important
}
button {
outline: 0 !important;
border: none;
background: 0 0
}
button:hover {
cursor: pointer
}
iframe {
border: none !important
}
.limiter {
width: 100%;
margin: 0 auto
}
.container-table100 {
width: 100%;
min-height: 100vh;
background: #c4d3f6;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
padding: 33px 30px
}
.wrap-table100 {
width: 960px;
border-radius: 10px;
overflow: hidden
}
.table {
width: 100%;
display: table;
margin: 0
}
@media screen and (max-width:768px) {
.table {
display: block
}
}
.row {
display: table-row;
background: #fff
}
.row.header {
color: #fff;
background: #6c7ae0
}
@media screen and (max-width:768px) {
.row {
display: block
}
.row.header {
padding: 0;
height: 0
}
.row.header .cell {
display: none
}
.row .cell:before {
font-family: Poppins, sans-serif !important;
font-weight: 700 !important;
font-size: 12px;
color: grey;
line-height: 1.2;
text-transform: uppercase;
font-weight: unset !important;
margin-bottom: 13px;
content: attr(data-title);
min-width: 98px;
display: block
}
}
.cell {
display: table-cell
}
@media screen and (max-width:768px) {
.cell {
display: block
}
}
.row .cell {
font-family: Poppins, sans-serif !important;
font-weight: 400 !important;
font-size: 15px;
color: #666;
line-height: 1.2;
font-weight: unset !important;
padding-top: 20px;
padding-bottom: 20px;
border-bottom: 1px solid #f2f2f2
}
.row.header .cell {
font-family: Poppins, sans-serif !important;
font-weight: 400 !important;
font-size: 18px;
color: #fff;
line-height: 1.2;
font-weight: unset !important;
padding-top: 19px;
padding-bottom: 19px
}
.row .cell:nth-child(1) {
width: 240px;
padding-left: 40px
}
.row .cell:nth-child(2) {
width: 240px;
padding-left: 20px
}
.row .cell:nth-child(3) {
width: 240px;
padding-left: 20px
}
.row .cell:nth-child(4) {
width: 240px;
padding-left: 0
}
.row,
.table {
width: 100% !important
}
.row:hover {
background-color: #ececff;
cursor: pointer
}
@media (max-width:768px) {
.row {
border-bottom: 1px solid #f2f2f2;
padding-bottom: 18px;
padding-top: 30px;
padding-right: 15px;
margin: 0
}
.row .cell {
border: none;
padding-left: 30px;
padding-top: 16px;
padding-bottom: 16px
}
.row .cell:nth-child(1) {
padding-left: 30px
}
.row .cell {
font-family: Poppins, sans-serif !important;
font-weight: 400 !important;
font-size: 18px;
color: #555;
line-height: 1.2;
font-weight: unset !important
}
.cell,
.row,
.table {
width: 100% !important
}
}
<div class=limiter>
<div class=container-table100>
<div class=wrap-table100>
<div class=table id=adi45>
<div class="row header">
<div class="cell hd">Full Name</div>
<div class="cell hd">Email Address</div>
<div class="cell hd">Username</div>
<div class="cell hd">Password</div>
</div>
<div class=row>
<div class=cell data-title="Full Name">Joseph Smith</div>
<div class=cell data-title=Age>27</div>
<div class=cell data-title="Job Title">Project Manager</div>
<div class=cell data-title=Location>Somerville, MA</div>
</div>
</div>
</div>
</div>
</div>
【问题讨论】:
-
我不明白这个问题。是什么阻止您更改媒体查询?
-
如果您希望 sll 视口大小的布局完全相同,为什么要使用媒体查询?如果一切都以相对术语(例如%)定义,那么您应该为所有人获得相同的布局。或许您可以更详细地描述问题所在?
标签: javascript html css media-queries responsive