可以判断当前屏幕分辨率,然后再给予对应的css文件路径,如:
html:
js:
window.onload = function(){
if((screen.width == 1024) && (screen.height == 768)){
document.getElementById('css').href = '1.css';
}else if ((screen.width == 800) && (screen.height == 600)){
document.getElementById('css').href = '2.css' ;
}else{
document.getElementById('css').href = '3.css';
}
}
screen.width是当前屏幕分辨率的宽度,screen.height是当前屏幕分辨率的高度
通过js判断,"屏幕分辨率为:"+screen.width+"*"+screen.height