Zrobiłem stronę ze stylami osobno dla smartfona i osobno dla PC
Dlaczego nie przełącza mi stylu na smartfonie tylko używa stylu dla PC ?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd"> <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"> <HTML> <HEAD> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="mobile.css" rel="stylesheet" type="text/css" media="handheld" /> <link href="pc.css" rel="stylesheet" type="text/css" media="screen" /> ....
Powinieneś uzależniać od szerokości/wysokości ekranowej, a nie typu media. Handheld, to nie telefon i tablet.
<html> <link media="only screen and (min-device-width: 900px)" href="pc.css" type="text/css" rel="stylesheet"> <link media="screen and (max-device-width: 800px)" href="mobile.css" type="text/css" rel="stylesheet"> </html>
<style> @media all and (max-width: 900px) { background-image: url("logo_mobile.png"); } @media all and (min-width: 920px) { background-image: url("logo_pc.png"); } </style>
Ustaw inne przedziały. Zobacz przykłady https://gist.github.com/gokulkrishh/242e68d1ee94ad05f488 albo https://css-tricks.com/snippets/css/media-queries-for-standard-devices/
Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)