Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

How to make an existing website mobile friendly?

I have an existing website with a decent amount of SCSS, but it's not mobile friendly. Now I want to modify my SCSS assets to make it mobile friendly.

I've watched "mobile-first approach" from CSS layout basics, but is there an effective way to make a website mobile friendly when it was first developed for desktop?

Thanks in advance!

2 Answers

Mike Wagner
Mike Wagner
23,888 Points

Essentially, the process would be the same as making a mobile-first that expands as the screen size does using relative sizes and media queries. Instead of growing elements you would shrink them, min-widths usually become max-width, and so on. However, in practice this can sometimes become quite challenging, which is why it's usually good practice to go mobile-first. In my experience, taking a desktop-only to mobile-friendly will usually begin with adjusting the existing styling (make sure to make a copy of your stylesheets first) to look good on small screens and then building them out with the needed changes and previous values that make it look the desired way on larger screens. Of course, a well-structured page that uses relative sizes will make the process easier, so sometimes it's not necessary, especially if you only have to change a few things.

I would suggest setting 3 or 4 media screens eg (max-width:680px), (max-width:980px), (max-width:1260px) and your original CSS. From there make sure your main page elements are contained within a wrapper as you can then easily adjust the canvas size for each screen size.

From there it is just about going through your class' and id's and begin changing the CSS within the media queries to adapt to the screen size.