PDA

View Full Version : [CSS] Caricare due css diversi a seconda della risoluzione dello schermo


D4rkAng3l
31-01-2008, 09:54
Ciao,
posso far caricare due CSS diversi a seconda della risoluzione dello schermo?
che ne sò se uno ha lo schermo impostato su 1280X1024 allora carica un CSS, altrimenti ne carica un altro....come posso fare?magari con javascript o qualcosa del genere...sob

Grazie
Andrea

MEMon
31-01-2008, 12:24
Esempio

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="it">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>bla bla blaaa</title>
<script type="text/javascript">
var res=screen.width+"x"+screen.height;
if(res=="1680x1050"){
document.write(
"<style type=\"text/css\">"+
".change-on-res{"+
"font-size:200%;"+
"font-weight:bold;"+
"color:#FF0000;"+
"}"+
"</style>");
}
else{
document.write(
"<style type=\"text/css\">"+
".change-on-res{"+
"font-size:50%;"+
"color:#000000;"+
"}"+
"</style>");
}
</script>
</head>
<body>
<div class="change-on-res">CIAO</div>
</body>
</html>