加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

媒体查询

发布时间:2020-12-14 05:13:32 所属栏目:大数据 来源:网络整理
导读:responsive design - On desktop PC,mobile css loads first,then it switches to the desktop version - Stack Overflow There are few approach you can use 1st Approach by using CSS File link rel="stylesheet" media="screen and (min-width: 600px)"

responsive design - On desktop PC,mobile css loads first,then it switches to the desktop version - Stack Overflow

There are few approach you can use

1st Approach by using CSS File

<link rel="stylesheet" media="screen and (min-width: 600px)" href="small.css">
<link rel="stylesheet" media="screen and (min-width: 4000px)" href="big.css">

2nd by using Javascript

if (window.matchMedia(‘screen and (min-width: 600px)‘)){
  document.write(‘<link rel="stylesheet" 
                  href="small.css">‘);
}

I suggest for better one you need use only one css file and define the concept like as below :

@media (min-width:320px)  { /* smartphones,portrait iPhone,portrait 480x320 phones (Android) */ }
@media (min-width:480px)  { /* smartphones,Android phones,landscape iPhone */ }
@media (min-width:600px)  { /* portrait tablets,portrait iPad,e-readers (Nook/Kindle),landscape 800x480 > phones (Android) */ }
@media (min-width:801px)  { /* tablet,landscape iPad,lo-res laptops ands desktops */ }
@media (min-width:1025px) { /* big landscape tablets,laptops,and desktops */ }
@media (min-width:1281px) { /* hi-res laptops and desktops */ }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读