之前一直没接触过 @media,今天有个项目用到了,其中语法格式为
@media not|only mediatype and (mediafeature and|or|not mediafeature) {
CSS-code;
}
mediatype 「媒体类型」
all: 所有设备
print: 打印机和打印预览
screen: 用于电脑屏幕
speech: 用于屏幕阅读器
mediafeature 「媒体功能」
常用的有:max-width、min-width

使用方式:

@media screen and (max-width: 699px) and (min-width: 520px) {
ul li a {
padding-left: 30px;
background: url(email-icon.png) left center no-repeat;
}
}
展开
评论