I have an HTML5 responsive web site and i have a link on the view for mobile devices which will go to pc view when user clik on it. But my problem is how can i load the css codes for pc view when the user click to this link ?
Asked
Active
Viewed 89 times
-1
-
Is it another HTML page? or is it the same document? – Jake Chasan Mar 21 '14 at 18:25
1 Answers
1
The screen resolution will probably be the deciding factor for you. Here are 2 ideas:
First Idea (in the HEAD of the HTML):
<link media="only screen and (max-device-width: 480px)"
href="iPhone.css" type="text/css" rel="stylesheet" />
Second Idea: Use Javascript to switch out the stylesheets.
I got some information from another post: CSS media type: How to load CSS for mobile?

Community
- 1
- 1

Jake Chasan
- 6,290
- 9
- 44
- 90
-
Okay, i got the idea but do i have to add this css link to all html pages related to this web site ? – Tartar Mar 21 '14 at 18:31
-
1Yes, I would think so. Because each page needs to know what stylesheet to use. Without it it would not know what file to fetch and inject into the web render. – Jake Chasan Mar 21 '14 at 19:34