首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >响应式表格更改jquery css的问题

问响应式表格更改jquery css的问题
EN

Stack Overflow用户
提问于 2020-01-04 11:52:45
回答 1查看 53关注 0票数 2

我包含了css以使表具有响应性,但这使得具有datepicker的td可以在单行中显示每月的日期

代码语言:javascript
复制
table {
    border-collapse: collapse;
    margin: 0;
    padding: 0;
    width: 100%;
}
table caption {
    font-size: 1.5em;
    margin: .5em 0 .75em;
}
table tr {
    padding: .35em;
}
table th,table td {
    padding: 625em;
    ext-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-ize: 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 {
        display: block;
        margin-bottom: .625em;
    }
    table td {
        display: block;
        font-size: .8em;
        text-align: right;
    }
    table td::before {
        content: attr(data-label);
        float: left;
        font-weight: bold;
        text-transform: uppercase;
    }
    table td:last-child {
        border-bottom: 0;
    }
}

​

​

​

​

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-01-04 15:00:43

您需要更具体一点,而不是更改html中的每个table元素。给你想要响应的表一个class,即myresponsivetable

<table class="myresponsivetable"> ... </table>

然后相应地调整你的CSS:

代码语言:javascript
复制
 table.myresponsivetable {
    border-collapse: collapse;
    margin: 0;
    padding: 0;
    width: 100%;
}
table.myresponsivetable caption {
    font-size: 1.5em;
    margin: .5em 0 .75em;
}
table.myresponsivetable tr {
    padding: .35em;
}
table.myresponsivetable th,table.myresponsivetable td {
    padding: 625em;
    ext-align: center;
}
table.myresponsivetable th {
    font-size: .85em;
    letter-spacing: .1em;
    text-transform: uppercase;
}
@media screen and (max-width: 600px) {
    table.myresponsivetable {
        border: 0;
    }
    table.myresponsivetable caption {
        font-ize: 1.3em;
    }
    table.myresponsivetable thead {
    ... and so on ...

然后,此CSS将不会应用于日期选择器

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59587738

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档