html - 如何为我的内联样式提供@media 查询?

标签 html css

我正在制作一个响应式网站并为此使用媒体查询,但是,我遇到了一个问题,即我给出了内联样式。现在我想针对不同尺寸的屏幕更改该样式。怎么办?这是我的代码。

<table class="edu_table" style="width:500px;margin-right:400px;margin-bottom:30px;">

在风格上我给了 width=500px;我想要 700px

@media only screen and (max-width: 1920px) {
}

1920px 大小的屏幕。请给出解决方案或提供其他方法来做这件事。我在很多地方使用 edu_table 类......我想要 width=700px;适用于 1920 像素的屏幕尺寸和特定位置。

最佳答案

<table class="edu_table"></table>

删除内联样式

 .edu_table{
         width:500px;
         margin-right:400px;
         margin-bottom:30px;
    }
@media only screen and (max-width: 1920px) {
    .edu_table{
         width:700px;
    }
}

如果你不能删除你的内联样式然后使用重要

@media only screen and (max-width: 1920px) {
        .edu_table{
             width:700px !important;
        }
    }

关于html - 如何为我的内联样式提供@media 查询?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31310953/

相关文章:

html - 我如何阻止我的 bootstrap 轮播改变大小

javascript - 在表单下方左对齐新的待办事项列表项

javascript - 为什么我的 jquery 在滚动动画时需要这么长时间?

javascript - Highcharts 工具提示在内容更改时自动调整大小

javascript - 我想使用 jquery 在标签之间附加 anchor 文本

jquery - 如何使用纯 CSS 在当前状态下更改图像 onclick?

php - 如何在 Bootstrap Modal 中传递 GET 变量?

html - 移动布局不呈现宽度 : 100%

javascript - 如何在语义上改进此 UI 搜索选择下拉列表

html - jqgrid fluid 最后一列适合