您好我有一个div,我已经应用了样式
position:relative;
这是我的代码
#cssmenu ul li{
margin: 0;
padding: 0;
border: 0;
list-style: none;
line-height: 1;
display: block;
position: relative;
}
媒体查询中的我不想要任何位置属性position:static;
这是我的媒体查询代码
@media (max-width: 768px), only screen and (-webkit-min-device-pixel-ratio: 2) and (max-width: 1024px), not all, not all, not all, only screen and (max-width: 1024px) and (min-resolution: 192dpi), only screen and (max-width: 1024px) and (min-resolution: 2dppx)
#cssmenu, #cssmenu ul, #cssmenu ul li, #cssmenu ul li a, #cssmenu #menu-button {
position: static !important;
}
此查询无法帮助我实现输出 如何删除媒体查询中的位置属性
答案 0 :(得分:1)
媒体查询部分存在语法错误,每当我们定义媒体查询时,我们都需要在括号下包含样式,如:
@media (max-width: 768px){
<our css style>
}
工作代码:
#cssmenu ul li{
margin: 0;
padding: 0;
border: 0;
list-style: none;
line-height: 1;
display: block;
position: relative;
}
@media (max-width: 768px),not all, only screen and (-webkit-min-device-pixel-ratio: 2) and (max-width: 1024px),screen and (max-width: 1024px) and (min-resolution: 192dpi), only screen and (max-width: 1024px) and (min-resolution: 2dppx){
#cssmenu, #cssmenu ul, #cssmenu ul li, #cssmenu ul li a, #cssmenu #menu-button {
position: static !important;
}
}
<div id='cssmenu'>
<ul>
<li>Ankit</li>
<li>Ch</li>
</ul>
</div>