Html 为CSS代码创建一个类
为下面提到的代码创建自定义CSS类。我正在使用此代码在WordPress中显示表格。任何人,请引导我为这段代码创建一个单独的CSS类。提前谢谢Html 为CSS代码创建一个类,html,css,Html,Css,为下面提到的代码创建自定义CSS类。我正在使用此代码在WordPress中显示表格。任何人,请引导我为这段代码创建一个单独的CSS类。提前谢谢 body { font-family: "Open Sans", sans-serif; line-height: 1.25; } table { border: 1px solid #ccc; border-collapse: collapse; margin: 0; padding: 0; width: 100%; t
body {
font-family: "Open Sans", sans-serif;
line-height: 1.25;
}
table {
border: 1px solid #ccc;
border-collapse: collapse;
margin: 0;
padding: 0;
width: 100%;
table-layout: fixed;
}
table caption {
font-size: 1.5em;
margin: .5em 0 .75em;
}
table tr {
background: #f8f8f8;
border: 1px solid #ddd;
padding: .35em;
}
table th,
table td {
padding: .625em;
text-align: center;
}
table th {
font-size: .85em;
letter-spacing: .1em;
text-transform: uppercase;
}
@media screen and (max-width: 600px) {
table {
border: 0;
}
table caption {
font-size: 1.3em;
}
table thead {
border: none;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
table tr {
border-bottom: 3px solid #ddd;
display: block;
margin-bottom: .625em;
}
table td {
border-bottom: 1px solid #ddd;
display: block;
font-size: .8em;
text-align: right;
}
table td:before {
/*
* aria-label has no advantage, it won't be read inside a table
content: attr(aria-label);
*/
content: attr(data-label);
float: left;
font-weight: bold;
text-transform: uppercase;
}
table td:last-child {
border-bottom: 0;
}
}
给您的表设置一个类,如
,然后对css执行此操作
body {
font-family: "Open Sans", sans-serif;
line-height: 1.25;
}
.sep-table {
border: 1px solid #ccc;
border-collapse: collapse;
margin: 0;
padding: 0;
width: 100%;
table-layout: fixed;
}
.sep-table caption {
font-size: 1.5em;
margin: .5em 0 .75em;
}
.sep-table tr {
background: #f8f8f8;
border: 1px solid #ddd;
padding: .35em;
}
.sep-table th,
.sep-table td {
padding: .625em;
text-align: center;
}
.sep-table th {
font-size: .85em;
letter-spacing: .1em;
text-transform: uppercase;
}
@media screen and (max-width: 600px) {
.sep-table {
border: 0;
}
.sep-table caption {
font-size: 1.3em;
}
.sep-table thead {
border: none;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
.sep-table tr {
border-bottom: 3px solid #ddd;
display: block;
margin-bottom: .625em;
}
.sep-table td {
border-bottom: 1px solid #ddd;
display: block;
font-size: .8em;
text-align: right;
}
.sep-table td:before {
/*
* aria-label has no advantage, it won't be read inside a table
content: attr(aria-label);
*/
content: attr(data-label);
float: left;
font-weight: bold;
text-transform: uppercase;
}
.sep-table td:last-child {
border-bottom: 0;
}
}
此代码不起作用。您是否将表设置为“sep table”类?你应该认真学习html和css的基础知识,还有很多教程和有用的网站。看看W3schools这显然是个怪人问题。如果不是,它显然缺乏最基本的研究工作-1@connexo我编辑了问题请删除暂停