css - 响应式样式不适用于不同尺寸屏幕上的悬停状态
问题描述
我有这些风格:
@media (min-width: 769px) and (max-width: 992px)
{
.box:hover{
background-color:#000000;
}
}
@media screen and (min-width: 993px)
{
.box:hover{
background-color:#ffffff;
}
}
当我的屏幕介于 769 像素和 992 像素之间时,框的颜色会保持 #ffffff,而它应该变黑 #000000。
我错过了什么吗?
解决方案
你忘了添加screen
,现在这个词and
正在工作
@media screen and (min-width: 769px) and (max-width: 992px)
{
.item_image--products:hover{
background-color:#000000;
}
}
@media screen and (min-width: 993px)
{
.item_image--products:hover{
background-color:#ffffff;
}
}
推荐阅读
- angular - 如何修复此未定义的 addEventListener 错误
- python - 如何将sql中的多个重命名聚合变量转换为python?
- node.js - Telegraf:“replyWithInvoice”不适用于“callback_query::”
- mysql - 使用十六进制表示法将 UTF 符号插入 Mysql
- powershell - PowerShell 开关参数未按预期工作
- swift - xcode中“产品”下的“应用程序”是什么?
- python - 仅读取单行时,会丢弃命名管道内容
- javascript - 从非异步调用 Async/await 函数并添加值返回未定义
- android - filter() 方法不适用于我的列表视图
- node.js - 在 MVC Express 应用程序中创建数据库服务