覆盖内联css?

时间:2018-06-16 15:01:05

标签: html css

我的html代码中有css,例如:

 <img src="" style="width:500px;">

我希望普通桌面/笔记本电脑屏幕上的图像很大。

但我希望图片能够在移动设备上做出响应。

我已经将我的css文件中的img设置为宽度:在某个屏幕分辨率下为100%,但上面的内联css代码似乎覆盖了样式文件中的css。

@media screen and (max-width: 720px) {
.container .row p img {
    width:100%;
}
}

有什么想法吗?

2 个答案:

答案 0 :(得分:4)

您需要使用!important

@media screen and (max-width: 720px) {
.container .row p img {
    width:100% !important;
}
}

答案 1 :(得分:0)

使用!important标签会让浏览器知道要使用一个。

这应该有效

{{1}}