This is a rather expansive topic, but in general when Google complains of your site not being mobile friendly, it's referring mainly to the layout of your page and font size, and not the scripts on your page. Adding a viewport
tag is just the very first step in optimizing your site to be mobile friendly (and Google compliant):
Code:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
If that's all you did with no other changes to your page's CSS to optimize the viewing experience for smaller screen devices, then you're actually doing more harm than good, making the page even more cumbersome to view with the additional scrolling and panning to get to the desired part of the page.
The next step is to examine the layout of your page, and start using CSS media queries to selectively hide non essential portions of your page as the screen size gets smaller, such as the left side bar, banner or header images that exceed the width of the target viewing device etc. The goal is to end up with just your primary content that can be viewed comfortably by the mobile user without the need to scroll horizontally or squint to read it. For example, in your CSS file, you might add the following CSS to enlarge the default font size of the page and hide the left side bar of your page once the width of the browser falls below 740px:
Code:
@media (max-width: 740px){ /* responsive layout break point */
body{
font-size: 1.1em;
line-height: 1.5em;
}
#leftcolumn{
display: none;
}
}
Test out your page against various different browser dimensions to see how the page reacts based on CSS media queries you've added to your page to simulate how it will look on mobile devices, and if the viewing experience is optimal.
Using CSS media queries alone should help you pass mustard with Google, but to make your site truly responsive, you may need to modify the markup of your page as well to use a responsive layout such as those offered in our CSS layouts section. Or you can take things a step further and use a responsive CSS framework such as Bootstrap.
Bookmarks