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

John Levy
John Levy
1,451 Points

How to link two different CSS pages one for mobile and one for desktop

I designed two different pages. One for the desktop and another design for mobile. How do I link them together on the HTML page. For example for <h1>-<h3> for the desktop and mobile the text is different so what is the best way to connect the two pages. Right now I have two different HTML and CSS pages. Should they be on the same HTML page or separate HTML pages? If they should should be on separate HTML pages how do I link them? Thanks in advance

3 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

Hi there Jon,

If you want 2 separate web pages you might look into getting a mobile sub domain so it is only picked up detected on mobile devices... and use that one for your mobile site and then put your desktop site on your main domain.

However it is best practice to put all your content on the same site whether it be for mobile, desktop and tablet. So the content remains the same but the layout will respond to the available staging area of your device.

Typically what you'll do is design for mobile which will contain your most important content and then introduce more content as the width increases. This is known as a mobile first approach.

Aurelian Spodarec
Aurelian Spodarec
10,801 Points

Use Sass : d and like Jonathan said.

John Levy
John Levy
1,451 Points

Thanks for your help