Marshall
Ecommerce Template Guru
USA
1984 Posts Pre-sales questions only (More Details...)
|
Posted - 03/04/2013 : 11:20:03
While I am not a big advocate of Responsive Designs, and by no means an expert, I thought I would share some useful links and tips I learned while converting my one site.
Responsive Designs do not require multiple style sheets. Using the @media rule, you can keep your site to one style sheet. However, the @media (and @import) rule does not work on IE8 or earlier, so you may have to make a separate style sheet specific to IE8 and earlier, but more on that later.
Using @media, a mere three lines of CSS can adjust your site to a mobile device. For example, for my one site From Our Heart, I have the width of the page wet using an outer wrapper, 1010 pixels. Everything within the wrapper is set to percentages. While a site set to 100% width will reduce to accommodate smaller devices, there are some devices with wide screens such as the Samsung Galaxy tablet with is 1280 pixels wide and no matter if your site is a specific width or 100%, the Galaxy Tablet does create issues. Your site will render in its entirety, but will be very small. However, on a Kindle Fire, it will look okay. This is just one of the issues confronting a Responsive Design. To accommodate the Samsung Galaxy tablet, I added a few lines to my CSS using @media: [code] @media screen and (min-device-width: 1081px) and (max-device-width: 1280px) and (orientation: landscape) { body { font-size: 1.25em; } #wrapper { max-width: 100%; margin: 0 70px 0 10px; } #center { max-width: 950px; } #contentCenter p { line-height: 2em; } #contentCenter a, #contentCenter a:active, #contentCenter a:hover, #contentCenter a:visited { text-decoration: underline } } [/code] With this code added to my CSS, I was able to adjust for the Samsung Galaxy very easily. Since PC’s/Laptops do not recognize the (orientation: landscape), this code will not affect the CSS. Same holds true for (orientation: portrait) Granted, there were other tweaks I had to made, but I did all my device specific CSS adding no more than 10 lines of CSS to my existing CSS file using the @media rules. I also increased the font size for the Samsung Galaxy as it appeared very small.
Also using @media, you can easily make you site look good and function down to a screen as small as 200 pixels. Some additional tweaks you might have to make is the height of the products <div> as they will get taller as you go from 3 columns to 2 to one. You may also want to underline you hyperlinks for small screens and increase the line height to make it easier to use your thumb. These are just a few things to consider.
You can also use @media only print { } to easily make a printer friendly version.
IMPORTANT When using @media, your styles are contained within the curly brackets { } of the @media.[code]@media { /*beginning @media curly bracket*/ body { margin: 0} /*more styles */ }/*end @media curly bracket*/[/code] A few non-PC/Laptop specific <head> tags you may want to consider are the following: [code]<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes" />[/code] This code allows or denies rescaling (zooming) of your site. [code]<meta name="format-detection" content="telephone=yes" /> [/code]This code makes your phone number a hyperlink so all your visitors have to do is tap it to call you. A thoughtful convenience. [code]<meta name="format-detection" content="address=no" />[/code]This code links you address to the phone’s map app. Again, convenient if you have a brick and mortar store.
And, of courses, there is Internet Explorer, the not always compliant browser. For anyone using IE9+, there should be no issues. However, IE8 and earlier can cause you problems. Aside from not recognizing @media or @import, IE8 and earlier does not recognize border-radius. IE7 and earlier does not recognize position: fixed, Max-width/height, min-width/height and so on. These are just a few issues. That being said, you may want to make an IE specific style sheet and take advantage of Internet Explorer’s Conditional Comment tag.
If you are not familiar with it, it is simply the following: [code] <!--[if lte IE 8]>Your Style Here or Link To A Style Sheet<![endif]--> In this example, it is for Less Than Or Equal To Internet Explorer 8 (lte) Your other options are (lt) and simply <!--[if IE 8]> <![endif]-->.
Before you go crazy over all of this, you will not accommodate every device perfectly. You can, however, make your site functional and look good with as little coding as possible, and less than you may have thought. Remember, some people pay for bandwidth so the less code the better.
REFERENCES For a fairly comprehensive list of screen resolutions, visit [url="http://spirelightmedia.com/resources/responsive-design-device-resolution-reference"]Responsive design device resolution reference[/url] For using @media and @import, the following sites are helpful:
[url="http://www.javascriptkit.com/dhtmltutors/cssmediaqueries.shtml"]Introduction to CSS Media Queries [/url]
[url="http://mislav.uniqpath.com/2010/04/targeted-css/"]Detecting device size & orientation in CSS[/url]
[url="http://www.w3.org/TR/CSS2/media.html"]7 Media types[/url]
[url="http://mattkersley.com/responsive/"]Responsive Design Testing[/url] This site will let you view yours on multiple screen widths, however, it will not adjust the font to a specific device.
As I said in the beginning, I am no expert on the subject, but I thought I would share the results of my research. If you have any specific questions, feel free to contact me.
Marshall
From Our Heart FromOurHeart.com Gifts, Plush Stuffed Animals, Toy, Games, Puzzles, 3D Gift Cards, Nostalgic Signs, and Collectibles
|
Marshall
Ecommerce Template Guru
USA
1984 Posts Pre-sales questions only (More Details...)
|
Posted - 03/04/2013 : 16:01:55
I made this its own thread, but should have placed it here. Sorry for the duplication.
Anyway, I created this scale to help determine the width/resolution of devices. [img]http://www.fromourheart.com/screen_scale.gif[/img]
If you use this, I suggest the following code in your <head> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta name="robots" description="noindex,nofollow,noarchive,nosnippet,noodp" /> <style type="text/css"> body { margin: 0; padding: 0; } </style>
Or you are welcome to use the one on my page which also includes a fixed width <div> for additional reference. - http://www.fromourheart.com/screen_resolution_scale.htm
Marshall
Edit - changed user-scalable=yes to user-scalable= no. For testing, this is the better setting.
From Our Heart FromOurHeart.com Gifts, Plush Stuffed Animals, Toy, Games, Puzzles, 3D Gift Cards, Nostalgic Signs, and Collectibles
Edited by - Marshall on 03/04/2013 23:13:31
|
Marshall
Ecommerce Template Guru
USA
1984 Posts Pre-sales questions only (More Details...)
|
Posted - 03/04/2013 : 21:21:51
Michael, Thanks  One thing I left out - MOBILE ICONS. You are use to using a favicon (image.ico) for your website, well mobile has different requirements. For mobile devices, favicons should be png images, not ico. There are typically three sizes: [code]<link rel="apple-touch-icon" media="screen and (resolution: 163dpi)" href="/mobile/images/icon57x57.png" /> <!-- 114 x 114 iPhone 4 icon --> <link rel="apple-touch-icon" media="screen and (resolution: 326dpi)" href="/mobile/images/icon57.png" /> <!-- 57 x 57 Nokia icon --> <link rel="shortcut icon" href="/mobile/images/icon57x57.png" />[/code] You can also create a shortcut icon. This should be 158px square png image. The link code is [code] <link rel="mobile-icon" href="/_src/mobile_icon.png" />[/code] You can read more about mobile icons here - http://mobilewebrockstar.com/blog/mobile-icon/ MarshallFrom Our Heart FromOurHeart.com Gifts, Plush Stuffed Animals, Toy, Games, Puzzles, 3D Gift Cards, Nostalgic Signs, and Collectibles
Edited by - Marshall on 03/04/2013 21:51:55
|