Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

2 CSS files, 1 for mobile and 1 for computers [duplicate]

Tags:

html

css

mobile

I have 2 CSS files, 1 for mobile devices and 1 for computers, laptops.. See below:

http://www.townhouseistanbul.com/skin/kevintimmer/css/tablet.css http://www.townhouseistanbul.com/skin/kevintimmer/css/large.css

Is it posible to load tablet.css only on mobile devices, and not when a user make his screen smaller on a computer.

Code below didnt work for me :

<link rel="stylesheet" href="http://www.townhouseistanbul.com/skin/kevintimmer/css/large.css" type="text/css" media="Screen" />
        <link rel="stylesheet" href="http://www.townhouseistanbul.com/skin/kevintimmer/css/tablet.css" type="text/css" media="handheld" />

Any ideas?

Thanks!

like image 902
KEVIN Avatar asked Dec 31 '25 03:12

KEVIN


1 Answers

try this

<link id="stylesheet-tablet" media="(min-width: 480px) and (max-width: 979px)" href="tablet.css" type="text/css" rel="stylesheet">
<link id="stylesheet-mobile" media="(min-width: 0px) and (max-width: 480px)" href="mobile.css" type="text/css" rel="stylesheet">

and use this meta tag

<meta name="viewport" content="width=device-width, height=device-height" />
like image 180
saman khademi Avatar answered Jan 04 '26 18:01

saman khademi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!