Hi there, in this video we are going to install Bootstrap4 on our website, using VS code, it's super simple, let's jump in now, and work it out.
First up let's create our own new local folder. So we're done with Project3, thank you very much, now it's Bootstrap time. So we're going to go to 'File', we're going to go to 'Open', and we are going to, on our Desktop create a new local folder. In this case we're going to call it Project4, unsurprisingly. Let's click open, and let's close down the Welcome tab that opens up. Let's just tidy this up, let's get rid of that line, and let's create our first file.
So we're going to create Index, we have been going 'File', 'New', that works fine. I'm going to show you, just right clicking in this area down here, you can go to 'New File', and this is a different way, I like it, nicer. So created my Index, it's open here, I'm going to twirl that open. I don't like that open whenever this thing opens, just while we're learning at least. HTML file needs all the basic stuff. So we need exclamation mark, '!', hit 'Return'.
It will give us most of the doc type and all the bits we need. Now I'm going to introduce you to the Bootstrap website. It is called getbootstrap.com, this is the official kind of page and documentation. All sorts of goodness that will help us with Bootstrap. Now we're using Bootstrap4 at the moment. If you're watching this in the distance way future, and it's up to Bootstrap5 it's going to look completely different, but the essentials will probably be the same. So what we want is we want to get started. You can download it locally on your machine.
If you don't plan to use it don't put it in, because it's just going to add to the Load Time. So we're going to copy the CSS, and it tells you where to put it. Put it in a link in your Head. They've given you the code, ready to go. So I've copied it, in here it says, put it at the Head, and there it is there. So we've done this a few times with different CSS'. We've done it with Google Fonts, last we did was, that's all I can remember. The other thing to remember is that if you create your own Style sheet, which we'll do in a second, it needs to be above that, so this is at the top. Bootstrap, always at the top, and your style, just underneath. We don't have that just yet.
In here I'm going to put in some comments. So remember, 'Command /', or 'Control /' on a PC, and just add some notes. Just to double check the CSS is actually working, let's preview the page. Remember that stopped working down there, so just going to right click it and say, 'Open with Live Server'. It's going to open on the right screen today. Nothing there, so it's not working, but it's, let's see-- the way to check if it's working is just to throw in an H1, and type in 'Hello World'. And just check, you'll know the CSS is working, because it looks nothing like our regular old H1. Our old H1, looks like-- comment that out, that stuff. So with it in, looks like that; pretty.
Now the one thing that VS code doesn't put in, in our kind of-- remember, we used the exclamation mark, to put in most of the information for the page, there's one thing that it suggests here, that's not part of that initial VS code. Remember, it's different, we looked at the different code editors, and how they implemented all this kind of Head tag. This is one here, the 'shrink-to-fit=no' is missing, so we've got all that, but we need a comma, and 'shrink-to-fit=no'. What does it do? Put it in first, it goes here, before the closing of the quotation marks. I think it disabled something, there's a weird setting in Safari, that messes with Bootstrap, so you can turn it off. It just means you're going to have consistency across different browsers. And that is it installed.
Now the crazy thing is, if we look on our Desktop, is that in Project4 we have just the Index page. So remember, these are being loaded from our Content Delivery Network. So Bootstrap are controlling this, they have it on their server. Same with all of these, and they're just getting loaded as the page loads. You can download them from 'Get Bootstrap'. The only trouble is that the browser will have to load them from your site, when probably the person visiting your site has probably already downloaded the CDN version from another website, so won't have to again, and it will make the page load nice and fast.