This lesson is exclusive to members

Responsive Web Design Essentials - HTML5 CSS3 Bootstrap

How to test your website on a tablet or mobile phone from Visual Studio Code

Daniel Walter Scott

Download Exercise Files Download Completed Files

Contents

Certificates

We’re awarding certificates for this course!

Check out the How to earn your certificate video for instructions on how to earn yours and click the available certificate levels below for more information.

Introduction

I recommend hosting your new website with Bluehost, you can get a big discount by signing up with this link: https://www.bluehost.com/track/byol/byol_webess_81

You need to be a member to view comments.

Join today. Cancel any time.

Sign Up
All right, so we need to test this thing. So while we're working often it's just easier to test in a browser, like we've been doing, but we need to fake it a little bit more. We're going to emulate an iPhone and a tablet, and desktop through Chrome. We'll do that in a second. 

Another way you can do it is actually just have like a throw-away domain name and hosting account. So go to Bluehost, use that same account that you set up. Buy a new domain name, called Dans testing website. Something professional if you're going to show it to potential clients, and Bluehost will divide your hosting account into two parts, so that you can use it. You'll get different login FTP details. Talk to them about it, tell them what you want to do to. Two domain names, same hosting, and then you just upload it, like we have earlier on in this course. We just upload it using our little FTP. You'll have different details for it, then you can just test it on anything. You can just load up that website on your phone, your old iPad, your new iPad, and just check it out that way. 

Another way, the more official way is to use a local testing service. We're not going to go through how to set it up in this course, it's a little bit out of the scope. So if you're on a Mac it's really common to use MAMP. It is Microsoft Apache MySQL and PHP. I totally read that from down there. MAMP, it's a really weird word, there's XAMPP, there's WAMP. So on a Mac, MAMP would be the most common one. On a PC it's either WAMP or XAMPP, probably XAMPP. 

Basically it's software that gets installed on your computer, and it allows you to fake a server on your machine, as if it was, say Bluehost, but nobody else in the world can see it, so you can keep it nice and close, but there is a bit of a hassle getting it set up, but in terms of testing most people will just test locally in the browser, and emulate while they're building, and only do kind of more official testing a little bit later on. 

So at the moment we were just doing this. We're doing the old drag option, and that works. I'm pretending I'm a desktop, I'm vaguely pretending I'm a tablet, and now I'm kind of almost a mobile phone. So to get around that, or emulate it properly, right click anywhere, and go to 'Inspect', or go to 'View', 'Developer', and go to 'Developer Tools', or 'Inspect Elements', either of these ones. Get it going, these two, and what we're looking for is something like this. So this little slide bar's probably all the way out here for you, I'm not too sure. What you might have to do is, because there's, I can't like get it back to absolute zero, I've tried to reset it for this course, but I'm not exactly sure what the default is. 

So up in the top here set it to 'Responsive', if it's not already, and you can drag this little double line over here, and you can see, I dragged it past, I can drag it teeny tiny. So I don't have to use that 500 anymore, I can actually get it to something a bit better for testing, and it is 400. Cool things you can turn on that might be helpful, is up here, see these little dots, these are real helpful. Let's turn on 'Show Media Queries'. So showing me my Media Queries, those are ones I added. Can you see, if I hover above them, it's the 768, and it's 400. So you can drag it, at least you know exactly when this thing gets triggered. 

I find this really useful when I've opened up somebody else's website, and you're like, "How many Media Queries are there?" You can kind of see them all, you can click on them as well, to kind of jump it out, to have a little look through the different options. Other useful things is this, kind of half looked at this. Let's look at what it looks like in an iPad Pro. It kind of zooms it out a bit because it wants to show you this whole thing, but it's the right width in relation to the outside, 400, 600. iPad Pro is about a thousand pixels across, 1024. 

What else we got? Let's look at-- they don't have them all in here, you can edit them and add your own. I know that this is reasonably old. It's got all the new iPhones but not the new Pixels and not the new Galaxies. So let's go and find X, you get the idea, right? And because it's trying to fit it all in it's scaled it down a bit. So you might just keep it at 100%. So you're not kind of that, that's what I pay a Pro, looks a bit weird. Zoomed out 41%, you might say, "Actually, just want to see it at actual size on an iPad Pro. Throttling, yeah, you might get into that. If you put in 'Low end mobile', and hit 'Reset' now, what it's going to do, it's going to try and mimic how long it would take on a really bad internet connection. We can flip our iPad Pro around. 

What else can we do? Other useful things, Device Frame, here we go, ready? Going to look like, actually do they have, don't even know if they have. So Device Frame, where is it, Show Device Frame, they don't have it for the iPad Pro, let's go to iPhone 4. Seem to have that one, maybe have to turn it back on again. Add High Device Frame, Show Device Frame. That works every other time I'm doing it. It will have the picture of an iPhone around the outside. Zoom out, maybe they need to zoom out a bit. It will work for you, I promise, works for me every other time. 

What else? It's not that important though, it would just look like an iPhone. We can do Screenshots, Picture Ratio, we'll talk about later on. Device Type, don't need that. That is it, I'm just kind of reading through, you know how to do that. That is the super easy way to kind of mimic what it's going to look like, and that's what we'll be using more and more, especially when we start doing things like mobile. 

Now the other thing is, this might not look exactly the same when you're doing it. You might be doing it in the future, with your flying cars. So it's not-- it might not be in the right places, but it will probably be turned on in a similar place, under View, and some of these buttons might have changed and be updated, but the core of it will be there, you might just have to Google where it's all moved to. Google do like to move things around. All right, that's it for this video, let's get on to the next one.