Hari's Corner
Humour, comics, tech, law, software, reviews, essays, articles and HOWTOs intermingled with random philosophy now and thenSimple technique to make your site mobile-friendly
Filed under:
Tutorials and HOWTOs by
Hari
Posted on Fri, Apr 13, 2012 at 16:44 IST (last updated: Sun, Apr 29, 2012 @ 07:34 IST)
Now your site will be completely free of styling on devices with screens less than 1024px wide. Secondly you can optionally add this in the@media only screen and (min-device-width:1024px;) { // style here for devices above 1024px width }
<head>
section of your pages to make sure that the website doesn't zoom out on small devices, thus rendering the text unreadable by default:
This renders your site free of CSS and styles and also ensures that the text is normal sized on small screens. Unless you use complicated HTML that involves nested tables and features that use desktop-specific functionality, you wouldn't need to touch a line of the HTML code. And the best part is that the overhead is very light and you don't need a separate mobile-friendly version of the site. The technique above works best on websites using tableless design using a lot of<meta name="HandheldFriendly" content="true" /> <meta name="viewport" content="width=device-width, height=device-height, user-scalable=no" />
<div>
tags for alignment and placement. On mobile devices, these elements are simply placed one below the other in the order in which they are coded in the HTML.
Hope this article benefits those looking for a simple solution to make a website "mobile friendly" without going through a lot of customizations.
More useful information can be found in this Stack Overflow article and this one.
Comments closed
The blog owner has closed further commenting on this entry.
No comments yet
There are no comments for this article yet.