500px
我以为我只为之间的屏幕设置了一条规则,1024px
甚至在屏幕尺寸超过1024px
.
这是CSS。该.red
样式正确应用于小于480px
. 只是黄色适用于所有屏幕,即使max-width
是1024px
.
.buy {
border: 1px solid #ABABAB;
color: #333333;
display: block;
font-family: calibri,helvetica,sans-serif;
font-size: 12px;
font-weight: bold;
height: 25px;
line-height: 25px;
margin: auto;
text-align: center;
text-decoration: none;
width: 70px;
}
@media only screen and (max-width: 480px) {
.buy {
color: red;
}
}
@media screen and (max-width: 1024px) and (min-width: 500px) {
.buy {
color: yellow;
}
}