Welcome to the bootstrap 5 course in this video you will learn how to build responsive websites quickly with bootstrap 5. so this is the bootstrap website that they recently changed it and I think it looks really nice very modern because bootstrap was getting a bit of an outdated or old-fashioned type of reputation because front-end web development has changed a lot in the past few years we have react now and you Write CSS and react a little bit differently we have tailwind and CSS itself has also changed with flexbox and CSS grid but it looks great
and modern and I like using bootstrap for this project in the course too because it's very easy to use and their components also have a modern look now and from looking around it's very popular among its users so I'm confident that there will be a popular library for a very long time the project of this course is This one it's using the bootstrap components we will talk about what that means but those are things like the button the nav bar the carousel the modal the form in the model the accordion component but it's also using
the famous grid system of bootstrap and the utility classes it's also responsive and everything else that you need to know about bootstrap is in here so before we jump into the project I quickly want to Give you an overview of the most powerful features of bootstrap so first of all when you include bootstrap in your project you get access to built-in components so you don't have to create for example a whole button from scratch in HTML CSS yourself you only have to use one of the bootstrap classes like BTN and then one of the theme
classes like BTN primary and you will get a complete button including hover and focus States and a button is still a Pretty simple small component but you also get access to more complicated components like a responsive nav bar and Carousel and modals and an accordion component and even complete forms including with cool effects like floating labels and so these are all components that you get out of the box now if these components are not enough there are also third-party UI kits out there that you can use and they also adhere to the Bootstrap philosophy of
the grid and things like that so you can easily integrate them in your own bootstrap project now it also has a lot of so-called utility classes so these classes are used for uh you know one-off quick type of styles so for example you want to set a font size for a particular element for example The Heading or you know some text now you don't set a font size like CSS right font size 50 pixels or something like that so you set a font Size width by picking one of the options that you get there are
like five or six different options for the font size and one of the benefits of these these options is that it forces consistency because you don't want to have random font sizes all over your project you do want to have some kind of consistency right but there are other utility classes as well alright so another powerful feature is the container class because often what happens in your on Your website is that if you have a header for example the content will sit right against the edge of the viewport and we don't want that we want
there to be some padding right we want there to be some space between um the viewport Edge and the content and it's not only the header it's also the you know hero section or other you know content parts of your website so bootstrap has a container class which very nicely enter responsively Constrains the width and also centers the content immediately right it's just one class and boom a lot of problems have been solved so this is very powerful we'll see how this works in the project as well alright now bootstrap is also sort of famous
for its grid system so the grid system you know very briefly you can create a div and this is going to be a row so this is how it starts you create a row and then in that row you basically have 12 units to allocate That's how it works right so for example maybe you want two columns right so you have a row and the units then go to those columns so maybe we want two columns that are equally wide so we can both give them six units out of the twelve right so then you
can put anything in there and that will take up you know half the space and you can fine tune it maybe one column needs to be four units and the other a little bit bigger eight units right so now you get A different allocation and it's going to look slightly different that's the grid system in a nutshell we'll see how it works in practice also bootstrap is responsive pretty much out of the box so all of those components that we've seen the nav bar the carousel the model the accordion those are all responsive out of
the box and the utility classes like margins and font size and padding you can also change them depending on the viewport width right or break points Right so for example on smaller viewports right let's say mobile phones we don't want to have so much vertical space so I want to decrease the vertical space on smaller devices and then on bigger devices let's say tablet and upward words there should be more vertical space I think that looks better I think it's more suitable so that's very easy to do because with bootstrap you get these suffixes that
you can add so MD for example or LG doors all stand For a particular breakpoint so you can use all of these utility classes you can slightly change them to really fine tune it depending on the width of the device that you're trying to Target and it's a mobile first Philosophy by the way right so the default if you just use some utility class for a margin or padding for example without any of those breakpoints in the class that's going to be for mobile and then what you can do is from a particular breakpoint and
Onwards right and bigger you can change it for example right we'll talk much more about that and also the typography automatically scales down or up depending on how wide the viewport is right so on smaller devices it's automatically going to be slightly smaller and on bigger devices it's a little bit bigger now I will say bootstrap is most useful if you already know CIA business itself in fact I highly recommend that you master CSS Itself because it doesn't take that long and it helps you immensely as a front-end web developer so check out my professional
CSS course the link is in the description also because bootstrap does not cover a hundred percent of the things that you want to do so often you do need to write some custom CSS yourself so make sure that you have learned CSS itself properly alright so the link is in the description there are some other things that I quickly want to Explain to you so in my code editor here if I type some classes here I get these suggestions you do not get them out of the box in Visual Studio codes so you need to
install an extension if you want them so the extension is called HTML CSS what this extension can do you can see it's very popular but what it can do is it can see what you're linking to in your HTML so it can see the the style sheet that you that you're importing and it can see in the style sheet what kind Of classes there are available right so then it can suggest them okay now secondly how to include bootstrap in your project access so we will go through this of course but just to quickly show
you there are two options so option one is with npm and node.js and this will give you more fine-grained control because you get access to the actual source code of bootstrap so for example um if you use BTN or BTN primary that will give you a blue color if you Don't want to get a blue color for BT and primary you have to go into the source code and they use SAS for that which by the way is also taught in my professional CSS course but if you want to change the the primary color from
from Blue to a different color you have to do it like that right so you have to go into the to the settings into the source code and and configure it differently now of course that's more cumbersome to set up but you do get more Fine grain control now second option is a little bit easier but you don't get the source code you get the the build code and we can actually see what you get if you copy the link here and open it up in a new tab right so this is the actual style
sheet that we can simply link to with the link element in our HTML right so the browser will make a network request to this address and this is what we will get back and don't worry we'll see how this works very easy it's Just like linking to your own custom style sheet and this is what we get back and in here you can see there are some classes right so it's almost not legible here because this is the optimized code right the source code isn't SAS and you have to do it with npm this is
already the optimize the build code so it's going to be minified and things like that right so here you can see there's a certain class and then you can see what this selector I should say you can see What this rule set applies okay now some components need JavaScript as well for example the accordion component right here we can click and it does something right so bootstrap needs to get access to the click event with JavaScript and then do something so there's also a JavaScript portion of bootstrap so that's also what we're going to link
to because we're going to use some of those components that need JavaScript okay now bootstrap also has icons you don't have To use these icons there are also other options but these icons work well with bootstrap so you'll see see how we can include that and how it works and that's a quick overview of bootstrap now the best way to learn to actually learn bootstrap is to continue watching this video because I will build a project from scratch hair so you can see how all of this works in practice so try to make it all
the way to the end you walk away with much more clarity so let's jump Into it alright so now I'm gonna quickly create a complete website or page from scratch using bootstrap and it looks like this so we have a nav bar at the top right that's a out of the box component that you get with bootstrap then we have this Carousel slider if you click on one of these buttons we actually get a modal component from bootstrap with a form in there the form looks pretty cool because we have like a floating label that's
very easy to do With bootstrap and then we have this section over here with a particular layout we have the packages section with cards these cards also come from bootstrap and then we have the accordion components from bootstrap here in the frequently asked questions right and then we have a simple footer right so this project I will quickly show you how to build this it uses some of the components that you get from bootstrap some common components like buttons but Also bigger ones like nav bar and Carousel and it uses the grid system right so
that's a very important part of bootstrap it also has responsiveness built in right so you can see everything adapt to the viewport that's very easy to do with bootstrap a lot of components are simply responsive out of the box it's using utility classes that you get from bootstrap right so to to change the font size for example or to add padding and things like that right so we'll see How everything works and I'll do it pretty quickly okay so I have opened up my code editor here and I have opened a folder here that's how
it works with Visual Studio codes so the first file I'm going to create is an HTML file every website no matter how complicated starts with HTML and here I can type HTML and if I pick the second suggestion here I get a boilerplate so we'll change this in a second I'm also going to create my own custom style sheet because The thing with bootstrap is it doesn't cover a hundred percent of the things that you want to do so sometimes you need to write your own custom Styles that's why it's super important that you have
mastered CSS itself right so you need to know flexbox animations and transitions for example all these things you have to learn them you know in in plain CSS first in my opinion and then you can learn an abstraction like a bootstrap and learning the abstraction Will be very easy because you know how things work under the hood right so make sure you check out my professional CSS course the link is in the description right so now in HTML we do need to link to this style sheet here otherwise the browser won't know that it exists
okay I'm gonna call this something like Aurora tours right we can imagine this is a fictional company offering tours to where you can see auroras not sure how to pronounce that right so Aurora tours Uh travel with us I'm gonna right click here and open it with live server this is an extension in Visual Studio code and it will make sure that whenever you make a change in the HTML or css that it automatically updates the page so that you don't have to refresh all the time okay so now we have an empty uh page
let's see so I want to start with bootstrap now before we can even start that we need to make sure that it's actually included in our HTML I'm going To close the sidebar here so you can go to the bootstrap website you can search for bootstrap or bootstrap docs now when you do this you have to be careful because there's a bunch of different links here the first link that I'm getting here actually links to an older version 4.1 I'm actually going to use 5.2 but here you have 5.0 for example so that's also something
that you want to pay attention to so this is actually the website I want it also looks different From the other versions and here they also show you how to include it via VIA CDN right so we've discussed the other way of doing it you can change the source files like that you can change their variables and things like that which is not going to be necessary here this is for the CSS however some components like the uh well modal for example here when you click on the button and you open the model the accordion
component they have right they React to clicks so bootstrap needs to be able to access the The Click effect with JavaScript and then do something so we need to include JavaScript here as well and when you include JavaScript you can do it at the end of the body or you can do it in the Hat these days but when you do it like this you do have to include the defer attribute for uh well that's simply optimal so be careful with just putting a script in here linking to an external script because it will block
Parsing the rest of the page except if you include the fur here right so now we have both parts of bootstrap now very quickly you may be wondering why do we have this weird Integrity well this Integrity is basically a hash of what the content should be right so the browser is going to make a network request to get this style sheet here right but this server may be hack and when the browser you know tries to get the content there it may send something Malicious back right so here with this Integrity attribute the browser
will only apply it if this this is a hash if the hash of what we get back is the same as this hat right a little bit complicated but it's basically a security mechanism same goes for crossovers chance also for security we don't want to send any cookies or like identifiers to that server when we make that request right that's what that means not really important most Developers don't know what it is so don't worry but maybe you were wondering about that okay so now we have bootstrap installs I want to start from the top
here right so now we get to this part here and this is actually a so-called navbar component in bootstrap so with these bigger components I do not recommend trying to code them from scratch yourself because there's too many classes to remember let me actually make it a little bit smaller right so What you can do is you can simply go to the docs make sure you get the right version and then here we have all the components that you get out of the box right so we have we have more simple ones like buttons right
this button is going to be pretty easy to code from from um from just by memory because there's only a couple of classes that you have to memorize however with a carousel for example or a nav bar or modal there's just too many there's just Too many things going on basically so you do want to just go to the to the docks and you can read up on it but usually it's enough to just copy their examples and then modify it as you see fit right so here you can see we have nav and this
is an example to show and there's a navbar class navbar expand navbar brand navbar Toggler right don't cut this from scratch just copy one of their examples and customize it to get what you want so that's what I will do Here so let's take a look um yeah so this looks like uh what we want of course the layout is not the same but we'll change that in a second so I'm gonna copy this this example and then I'm gonna paste it right here okay so if I save that let's see what we get okay
so then we have this so we don't have the right color here so let's see so here they call it uh BG light now we we actually want BG dark this is actually a utility class meaning this BG Dark is not something that you only see with this component you can use it anywhere where you want a background color right let's see if I can quickly uh show that we'll talk more about the utilities I have so here we have utilities for the background right and they have some out of the box we're using BG
dark right so whenever you want to use uh right so whenever you need some kind of background you don't have to create a class and then select it and Then background color right you can just use one of those out of the box classes and it will immediately apply it now we want the text in here actually to be light so what you can actually do is you can theme you can use a theme class for this nav bar if we say that this is a dark nav bar it's a little bit counterintuitive but it
will actually make the text light because well the the navbar has a dark theme and therefore there's going to be dark colors in the Background and therefore the text needs to be white now also we don't want this navbar uh well what is this actually this is the brand so let's actually change this to our brand Aurora tours um we don't want this to sit against the edge or so close right so here there's more space Also here on the other side we'll change the layout in a second there's more space when you deal with
that with that stuff against the edge of the viewport you're working with the So-called container class in bootstrap this is a very handy class let me show you what they uh mentioned about that yeah so for layout containers yeah so here um the the two common ones are for example container fluid which is what we have now so it's whole right so this container fluid let me actually add some space so we can easily distinguish all the different sub components here so this container fluid is holding uh the Navbar brand and then also the links
and here we can see that means it's going to be a hundred percent width on all viewport so no matter how wide it gets it always stays against the edge here basically which is not what we want so there's another class simply container and you can see here that on various uh viewport is that the size of that container also changes so for example the container class so that's the first row here is going to be well on very Small devices and mobile phones 100 width which is what we want but on very large devices
it's going to be constrained it's only going to be 1320 pixels so I'm going to change this to Simply container which will constrain the width more as you can see and also when we make it smaller it doesn't start getting against the ad right so you can see that and by the way the the nav bar is actually already working as you can see right so it's already working with The collapse with this hamburger menu now there's one problem here of course which is that this should sit on the other side so let's see we
have this div which is holding those links right so um right so let's actually work on this a little bit so we want to remove this disabled we don't want that we have uh two other links packages and frequently asked questions okay now when you copy the stuff from the examples there's also going to be Area attributes here this has to do with accessibility and I'll probably make a different video on this I'm going to remove it because it may be confusing to some of you and I want to focus on uh the how bootstrap
actually works but it's very nice that they include the accessibility things out of the box as well so I'm also going to remove this because we only have packages and frequently asked questions right this is what we have and It shoots it on the other side so how can we do that well it's a little bit Advanced perhaps right so this this uh diff here is expanding the entire width here actually and then we have the UL sitting in there so we want to what we can do here is we can we can add margin
on the left side here and we can use margin Auto because it's actually a flex container right so this is why it's important that you understand the underlying fundamentals because Sometimes well you need to understand flexbox here for example because what you can do in a flex container like that is you can use margin Auto which will push itself all the way to the other side so I can say margin start so here bootstrap is not using margin left it's using margin start which is a little bit confusing but the reason for this is that
some languages they start from the right right so you reach right to left so from their perspective it's the it's Margin right so we cannot say margin left because for some languages it's not going to be correct so instead you have Martin stars and abstraction margin start and margin end right so margins start Auto which will create as much margin as possible here which will push it all the way here right so make sure you understand flexbox so I'm also also we also want to put this in uppercase so we can simply go to navbar
brand and we say one of the utility classes actually We don't have to you know do it in our own style sheet we can just use one of those classes and it's going to be uppercased right so this navbar brand class for example it adds some padding to the text in here it also removes that default styling that you get with an anchor tag like the blue color and the underline it removes that stuff so so that's why these out-of-the-box classes are handy but you're not going to remember all of these out of the box
Classes like nav bar nav bar brand navbar Toggler right so this Toggler this button is the actual button here and actually let's see yeah so here now we can talk about responsiveness because here um it's not um it's no hamburger menu yet but here it it already is right so we can also change that so the thing with a bootstrap is when you talk about responsiveness bootstrap has a mobile first philosophy so from their Perspective you start like this right you don't actually have to do this but this is simply how they how they have
structured the bootstrap classes and things like that so you start from mobile first and then you can decide at which breakpoint or that's a bootstrap has breakpoint and let's see this these are the ones that you're going to use often so let's see breakpoints yeah so these are the important breakpoints that you get in bootstrap so you can see we Have small medium large and we can decide from which break point onward the doesn't need to be expanded so we could say for example from medium or small let's say small from small and onwards it
should be expanded so from 576 pixels of width of the viewport right so when this viewport is 576 pixels wide or bigger it should be expanded right now we can actually see this it's X it's expanding when it when it reaches the large break point which is 992. we're going to change this to small right so you can use these suffixes like SM or LG with a lot of classes to really customize the The Styling based on some kind of breakpoint right so now on mobile it's still going to be a hamburger menu right but
then when we get to the small breakpoint it will be expanded that's the same as in the example right so navbar already gets a little bit complicated because it's a bigger component with with a little bit Of a tricky part with the hamburger menu so make sure you you follow the examples because especially as a beginner bootstrap developer it's going to be um you know too complicated in the beginning to do it by yourself from scratch right so just go to the examples and customize it as you see fit okay so then let's continue with
the second part which is this uh this is actually Carousel component this is actually also a bigger component and so whenever you Have that I recommend to just go to the doc to the documentation and then here for components Let's see we have Carousel and they have they always have examples so you you can have slides only but we have with controls when those are these things that's what we want but we also want with indicators those are those things right and we also want captions because that's going to be the actual text here so
there's a lot of uh HTML so I will quickly start off with With their simple uh version here just so we can get a little bit familiar with this very common component and then see how we can customize it so here we have the nav bar now typically an HTML document has a particular structure right so we have like a header and then the main part now we have the main and then eventually you have a footer right and this is actually not a header in bootstrap they call this a nav bar so I'm simply
using the nav tag maybe you're more familiar with this as a header I am at least but in bootstrap well they've they've gone with the nerd with the term nav bar now here in the main I'm just gonna paste the Carousel and that doesn't do anything yet because we don't have those images yet so now I'm just going to copy the image urls okay so I have copied the image URLs I'm saving the file here and now this is what we get so the problem with the Carousel is that it doesn't restrain the height of
the images out of the box so here we actually need to write some custom Styles right because these images are we we only see one image now but it will go to the next image in a second these images are too uh big right now so if we want to style this we do have to look at how it's structured here right so you can see it moved to a different image um so we have this div this overall div Carousel that there is a carousel inner class right are you going to remember that stuff
I don't think so just go to the documentation and copy it and paste it so it's basically just a bunch of different items that's what it's going to slide between so in the items we have the actual image so here we need to give the item a height so I'm gonna give it a custom class I think that's a little bit cleaner that we don't touch the bootstrap classes we just uh create our Own class I'm just going to call it C item and then we also need to style the individual images so same story
I will just use a custom class here right and then we can simply select it in our own style sheet as uh as as you are maybe you're used to okay so then we give the the item that's the parent element of these images we're gonna give this a height of 480 pixels and then we can tell the Images to take up a hundred percent of that right so when we do that um this is what we get now when you work with images it's very tricky but you um they have a certain aspect ratio
and when you start playing with their height and width that that can get distorted so you get a weird distorted look so typically what you want to do when you change the height or width of an image is you also want to say object fit cover Which will preserve that aspect ratio right so now you can see it looks sharp and it looks non-distorted now the images should be a bit darker because we're going to place text on top of it so we can simply use a filter brightness right this is something we have to
write ourselves this this does not there's no utility uh class for this right so again you need to know CSS itself and this is just one little silly thing but there are more important things like flexbox And animations and transitions I have to say that you really need to know about as well so that's uh those are the images look good so now we want to add those controls so we can switch back and forth so you go here and you see with controls and they they add some buttons here so actually we only have
to copy this I think and then we have to paste it let's see after Carousel inner uh let me add some space here as well yeah so here this should do it I think Yeah so now we have these um controls now if I click on them they don't work so let's see why not so they are using data attributes by the way right so here this button has a data attribute they use this because when I click on here there is a click event right and then they're going to use JavaScript to do something
but they need to know which Carousel because we could technically have multiple carousels it needs to know which Carousel needs to go to the next Slide so here they use an ID for that yeah so here this should be the ID this was a different ID because it was a different example I think it's a little bit strange that in their documentation for those two different examples they use a different ID it's very tricky so make sure that if you use the carousel that you pay attention to the ID right now this works right so
in HTML you can create your own data attributes as these are called so this is Technically possible and this is Handy for JavaScript purposes you don't really need to understand those specifics but this is what bootstrap uses under the hood right and then we have some Aria things here I'm just going to remove this for now right but those buttons here are pretty straightforward I think okay let's also quickly add the indicators I think this always look pretty cool shouldn't be too hard so here we see something with Indicators in this example so they place
it above the carousel inner and here they also use a Target because again you click on something so it needs to know which um Carousel needs to be uh changed if we have the indicators okay so last thing we have to do here is add the captions and that's the text here right so each slide has a caption and we're gonna style it like this you go to documentation there's actually an Overview here or we already see it with captions typically it's usually smaller text at the bottom like a small description but I'm just going
to use it as uh like headings for our page so each item because it's connected to an item has a can have like a caption right so here I'm just gonna copy this example here caption we can paste that in the item here and let's see what we get so then we get this caption and then we can style it um Here we actually just have a paragraph element then we have an H1 and then we have a button the button is actually also a component right so you get these buttons out of the box
this one always looks pretty cool I think the blue color is fine with me but this this is BTN and then you need to use BTN primary and then you get the button if you if you want to use BTM primary but you want a different color when you use the BTN primary class like that's an example of Of when you have to go into the source code and change those settings right and that's in SAS right so here we're not going to do that but that's a more advanced use case that you may want
to use at some point so here I'm just gonna have the text that's going to be the uh upper tags that's not going to be a heading it's just uh well text paragraph discover the Hidden World and then we have the Aurora tours that's actually going to be the most important Heading on the page so I'll use an H1 for that and then we have that button right I will I will add the classes BTN and BTN primary book a tour okay so then we have this so it needs to sit up here and this
is actually already so called absolutely positioned so what you can do with these captions is you can go here and you can use those offsets right so with with app position Absolute if you've ever used normal CSS and and you've used position absolute maybe you remember that you can use like top bottom right left we we're basically saying here it should set 0 pixels from the top right and there will be some space but this is already much better now it needs to sit a little bit lower so there are some classes for that as
well we can add margin on the top right so it's empty and then you don't say margin top 55 pixels but they Actually have like pre uh determined uh sizes and they do this because it it basically forces consistency right also with font sizes for example as we'll see in a second well actually let's do that so here for this one then we want to increase the font size so we can say fs and then you can use one of the numbers so for example fs3 and now this text is bigger we also want this
to be uppercase right so this with these numbers it forces consistency because we cannot Have all of these random font sizes like 51 pixels and and then somewhere else 28 pixels you have basically like five six different options and um yeah it basically forces a nice consistency which is very handy um because maybe you tend to use all sorts of different values so I'm also going to add some margin on the top so I say margin top five add some more margin then for this H1 I want to increase it as well so there's another
class for Sort of the font size it's called display I can also change the font weight I can save FW font weight Boulder and then also capitalize right so all of these are utility classes right and then it's bigger right so utilities these are just quick one-off uh classes right to usually to achieve one specific uh thing um and you can do all sorts of things like colors for the background for text there's all sorts of utilities and that's different from these other Classes like uh Carousel indicators right that's a different class it belongs to
the Carousel component and these classes often need to be used in conjunction right these utility classes can often be used um stands alone just one you know quick one-off Styles so let's continue with the button button needs to be a little bit bigger and more uh it needs to be positioned more or lower also this needs to be uppercase so let's see we can set Text uppercase and then the button um so for the button we want to add some padding and here we want to add padding both or on the left side and on
the right side so that's PX right so if we only want it on the left side we use PS for padding start or padding end right on the right side but if you want it on both sides right so we use x um for the you know horizontal Direction And then we have one of those you can use numbers again and then for the vertical axis we have p y so on both top and bottom we want to add well b y and then you have those numbers again you get these options basically by the
way if you want to get these suggestions make sure that you install the extension HTML CSS support right it will it can see what you're importing what you're linking to in your HTML right so we are linking to that bootstrap style sheet so It knows which classes are going to be available so here we want py2 and I will also make the font size a little bit bigger and I will add some margin on the top that is what we want okay let's remember these captions we did it for one item so now we can
do it for the other items as well I will quickly do that here right so I only have to change the text here so I will quickly do that okay so I just copied the captions to The other two items and just customize the text every slide has a caption right very easy to do with bootstrap if you have to do this in plain CSS that would take much more time okay now this is taking up a lot of space here in my HTML so what you can do is you can collapse everything here so
let's see I just want to make this Carousel collapse here in my HTML I'll do the same for the nav bar so we have a little bit of a better overview okay so now when we click on This button we actually want to see a modal right this is a modal component it works the exact same to be honest so I would go here I would go to components and then we have modal and you know you can read through it if you want but usually it's pretty straightforward you can just copy one of the
examples and customize it as you see fit so that's exactly what I'm gonna do here and I'm not gonna show you the whole process over and over again because there are Other things that I want to show you as well like the grid system some of the other utility classes so I will just quickly Implement that and then we'll continue right so I just copy and pasted the model I'm just doing it above the carousel this is the model and then we can customize the model but let's actually see if we can open this up
so that's something that we haven't seen before so how do we do that how can we open up This model because if we click on the button now it doesn't work well we are working with a click event again so usually when that's when that's the case you have to give something an ID so we give the model an ID I will call it booking model and then when we click on these buttons we want a signal to bootstrap that this is the model that we want to open up so if we go to the
button here bootstrap is using those data attributes So here we have to add two data attributes so it's called Data BS for bootstrap and it's basically toggling right so opening and closing is uh toggling so here we're specifying what needs to be toggled well it needs to be the modal and specifically the target is the element with a with an ID of booking model right so now I've given the first button here in this Garage in this Carousel um those data attributes and now it Opens up as you can see right now this is not
very smooth and also doesn't work yet for the other buttons but it's not very smooth right so if you want to make it smooth we can add a class here to the model called fade and then it's very smooth right I'll quickly do it for the other buttons as well right so I just added these data attributes for the other buttons as well so I can close the carousel again so now These other buttons work as well all right so now we can change the actual model right so I will just quickly customize this but
um it's very straightforward right so instead of the title should be book a tour um the body will actually be formed we'll do that in a second and this should be check out okay so then we have this now what we want in the body is actually a form and We have an input here with a floating label which means that when you make it focused the label appears to move up here and then we also have this select element with three options so forms are very important they actually have a whole section for themselves
here but this is also sort of you know sort of like a component it's just a bunch of classes that you tend to use together and it's the same thing you would go here you would look at some of the Examples you would copy one of the examples that you sort of want and then you can customize it so here with forms I will actually write it from scratch here because it's it's a little bit more straightforward here so we simply have a form element right this is just from normal HTML so then we have
that input so we just have an input element and the type is actually email the class here is going to be one of bootstraps so it's going to be form Control as they call it now we want to have this floating label so we do need a label as well so to connect that we need to give this an ID of let's say uh email or email one email one and this can be email address okay now you need to wrap this to make this a floating uh uh to make this float basically in the
input we can wrap this in a new element with a bootstrap class called form floating that's how bootstrap does it you wrap it in an Element with a class of form floating so then let's see so then we have this input but now the label is already floating here it's always floating so we actually need to add a placeholder but this can be anything actually because it's using the placeholder functionality of the browser to make that work so it doesn't really matter what you type here um but that's necessary for how this Works under the
hood right so now we have a very cool floating effect so then we also have that other one that's select and it's the same story with the select we actually also want a floating label so I will use the same here let's see pick a tour and now we will just have select one Brad I'm just uh adding another class called form select here which will style This as a typical bootstrap select element so in a select we have options we have those three options I will just quickly write them down okay so these are
the three options and this is actually the the form that we want right so now when you do that we have an input and we have a select so now it gets interesting because now we want to talk about the layout here because if we look here they are actually sitting next to each other Right so we can actually use the the grid system in bootstrap to work with this also because we want to have a different layout depending on the breakpoint depending on some break points right so you can see here on smaller devices
we actually do want to Stacked layout and then on wider devices we want to have a horizontal layer so how can we do this well here we can use the grid system so the grid system what it comes down to Is you create a new element with a class of row in the row you basically get 12 units to allocate right so the entire row is going to be 12 units wide and you can determine how many columns there should be and how many how many of those units they should take up so here we're
going to have we basically going to have two columns so we can say dot call dash six right so the First Column is going to take up six Of those units and the other column is also going to take up six of those units and it needs to be in the row right and then we can put this first div in here and it will automatically this will automatically take up the width that this one gets same goes for this one all right so now we have a row in the row you get 12 units
and we were basically giving we're allocating that equally to two columns right so now you Can see we have well a row and we have two columns right the elements in the columns automatically take up the entire width now we have some default space between them I think this is a bit much so you can also go to row here and you can give it a cutter or gap or you can Define how much that should be you get a couple of options here we want number two and that made makes it a little bit
less so this looks pretty cool but now the thing is it's going to be like this On all viewport right so what we actually want is this horizontal layout only on wider viewport right so maybe only when it has crossed a certain breakpoint so here we could say only when it has you know when it has crossed this maybe the small breakpoint and bigger do we want to have this horizontal layout so what you can do is you can go to these columns and you can say it should take up six units when it when
it reaches the small break points Right and when you do that the default is by the way stack yeah so this is working now you can see that it's stacked and then when it crosses the small break point it gets six units each and we get that horizontal layout now I was a little bit confused because here in the carousel something disappears on a small viewport and that's actually um some the default behavior in carousels is that these captions it hides them on small viewport right so This is actually something that we haven't changed yet
so in carousels we do want to make sure that these captions do not get removed and they do that by default with these two classes so this means display none and then from the medium breakpoint and onwards they make a display block again that's how they hide it so on smaller than medium it's hidden so we just want to remove this so that so that it's never hidden Another captions always stay here right so when you use captions that's a tricky one right but now we also have a very nice model and we'll practice more
with the grid system in a second now about responsiveness by the way in bootstrap I told you that it has a mobile first philosophy right so initially the default layout is that stacked and then we can define a breakpoint at which point it should be changed but that's how we did it here and that's how it Also that's how it always works with uh bootstrap so you can use this in fix in the classes in most classes we also use this here for example navbar expand small right so you can use it in many classes
but this always means from that breakpoint onwards and bigger right so it it it starts off from the mobile first approach and then you can do something when it gets bigger and bigger now does that mean that you have to develop your website from a mobile first Uh perspective as well like do you need to do mobile first or desktop first well I always do desktop first so even when I do when I use bootstrap I would use desktop first right because that's that's what I prefer in many ways I'm more of a desktop user
myself I'm not a very heavy mobile user so I tend to prefer developing websites from the desktop first approach however it does depend a little bit on your team on the type of project that you're creating but Simply because bootstrap has a mobile first philosophy does not mean that you have to create your bootstrap websites from a mobile first approach so that's just a side note okay so let's continue with the next section that's going to be this overview section and in here we're actually using icons so there are also so-called bootstrap icons you don't
have to use them in your bootstrap project but they tend to work well with bootstrap so here at the end they show You how to include it I will use a CDN a link again you can also just use the svgs but we'll use the classes I'll just include that here right so you do need to include this separately and then here after the carousel um let's see we're gonna have this um overview section so let's see this is going to be just a section we actually also have the section tag in HTML technically we
could actually make this A section as well for the carousel as well as for the modal semantically that would be better I think rather than here we would have um the overview section so I'll just use a custom class right so I would say overview you could also signal that this is your own class like C custom I actually also use that I used it for the carousel but that was for carousels he stood for Carousel but you could sort of you could sort of prefix your custom Classes so that you can easily distinguish between
your own classes and bootstraps classes so here we have an overview and we're gonna have um well three parts I'm just gonna use a div for each part and we're gonna have an icon and then we're gonna have some text so I'll just write down the text first three amazing destinations and here I actually capitalized it in the in the HTML here but you know Technically it's better to do this with CSS you want to separate the styling from the HTML okay so we have three parts and we have just attack so now we want
to add an icon to each part so you can write so let's say we want this plane you go to bootstrap icons and you can just you know scroll through it or at the top you can search for let's say plane let's say we want airplane fill you can go here and now you can use that element Because we already included here but you can also use the SVG the SVG is just using path right so it's it's instructing the browser how to draw this uh image right but I'm using this here and then um
I'll I'll use the other ones as well right so now I have included the other icons as well so now this is what we get so let's uh add some background color for this section and also uh get that layout so this section now we need to Give it some custom styles again we have given it a class of overview 180 pixels tall and will give it a background color and then this is what we get so here we're actually just going to use some flexbox to get this layout that we want right so again
really want to stress that that it's important that you have mastered the underlying fundamentals especially flexbox because that's what you need in the vast majority of layout Issues so here if we want to have everything sit on the same line like this it's very easy to use flexbox actually you could also use the grid system by the way and we'll use that here as well but with flexbox it's just very easy to get everything laid out like this so what we can do is we could simply say d Flex and then everything sits on the
same line and then we want to make everything sit vertically centered so there's Another utility class based on flexbox it's align items Center and then everything is vertically centered okay now one other problem here is that they're sitting right against the edge right we don't want that so we can use one of those container classes again now this overview section should span the entire width right so we're going to add the container class in here because we want to constrain the width of the content in there not not of the overall Overview class section because
we want to get a background color all the way to the edge right so that will add some space here now when we do that we do need to copy these classes to the other element now because um with flexbox it's always about a parent element and its child elements right but now we added an element in between the overview and a div right so now this should be the element that Guest has classes okay so they are sitting on the same line but we don't get that vertical centering anymore because this container does not
have the entire width or sorry height of this overview section so one other class we have to add here is h100 so it will take up 100 of the parent element and then they will be centered vertically again okay so now what we want to do we want to get them in this particular layout right so there should be some space Between them but also on certain viewports they should become stack right so where it's stacked and then at a certain breakpoint they should expand like this this is very easy to do with the the
bootstrap grid system so here I would I would use the grid system so here it always starts with a row so we'll do the row here we have a row and let's put all of these in the row and then we have 12 units that we can allocate right so we can already use This div so we have call and we can give each one let's say four right because we all want them to be equally big so then they get four columns each now the row here if you inspect this it breaks here because
the row is not taking up the entire width right now of the container so we need to give the row a width of 100 as well so we have a utility class for that as well right so now we get that more balanced layout we have three columns right but we want Them to be centered in that column so let's see we can just set text Center and it will be inherited by all of that we also want to increase the font size so we can just set it as here will be inherited right and
now we also want to add some margin on the right side of the icons because it's sitting too close right so there's not a right side but we have start and end so we can go to the icons we can say margin and now when you give everything an equal uh Size so we have we have 12 units right and we give each one four when you have an equal size you don't need to specify the actual number right so if you just say call it will automatically divide up the space equally like that now
what we want is of course that on uh that the initial layout is stacked and right now it will always stay like this right where it's like expanded and horizontal but we only want that from a particular viewport and Onward right so now we can use those breakpoints again maybe we only want that on XL and bigger so you only have to add XL here and now it's it will be stacked that's the default layout and only on XL and bigger will it will it become wide like that okay so that's the this section I
think we've done everything here looks like it so let's continue with the next one okay so next section will do the Auto sections uh a bit quicker so we have the packages section so let's quickly code that up let's see section and I'll give it an ID by the way because what we want is that when you click on this in the nav that you actually go there and this is just a feature that you get from the browser out of the box right so that's not bootstrap but you have to use the ID to
do that so we have the packages section here and Here we're going to use the card component this is a very common component that you want to use in bootstrap same with the other components it has a lot of different classes so you're not going to be able to code this from scratch I think so better to just go to the examples and copy them however before we do that let's think about the layout let's do the layout here first and the other things here so let's actually start with the with the heading Of this
section so we say it is an H2 and it says packages let's see packages should sit in the center though so we can say text to Center okay and we want to give this whole uh section some some margin or padding on the top I'll say padding top of five so that it pushes itself down a little bit and same goes for this heading I want to add margin both on the top and bottom so It's the y-axis so that's my so now it's sitting there okay so then we get to the cart let's think
about the layouts here we're going to use the grid system again so let's actually look at the default layout they say it is that it is stacked right so these cards are stacked now and only from a particular breakpoint and onwards do they become that horizontal layout right so very easy to do with the grid system you start off with a row right And then you have 12 units to allocate and we want those units we want those columns to be equally y right but only from a particular breakpoint and onwards so what you can
say you don't have to specify the number but we have three columns and we're going to have four and they're going to be equally big so we don't have to specify the number only the breakpoints at which point they should become that horizontal layout so here I just picked a large but we have Three of them right so now we can place the cards in here and the cards will automatically take up the width of that column right so bootstrap does not give these cards a set of width so it does not it does not
give these cards a width of let's say um 100 pixels it will make them um it will make them 100 by D files however here in the example you know that they do want to have they do want to give it a particular width just so They can show you how it looks like so here they actually do it with the style attribute right so when you copy it from this example make sure that you pay attention to that because we actually don't want them to have a set width like that right they should they
should simply take up the width of this column in which they are placed which it actually will do by default but you do need to make sure that you don't copy that style attribute so I'm just going To copy my car from the example here because it already has the correct text and images and so on right so now I've placed uh these cards in their respective columns just three right and we'll see how this works okay that's a little bit big but it does work however right it does work there are stack right they
are stacked and at the large breakpoint they do become horizontal however they're sitting right against the edge of the viewport right So here we can use that container class again to restrain the uh width so we can put that entire row in a container class right this is a very handy uh class that you get out of the box all right so now I've put everything in that container class and now it has restrained that uh width right so now it doesn't sit right against the edge right so now as I make it smaller and
smaller you can see we have a very nice looking layout here let me actually make it Bigger again and also when I click on the button here in the card it also opens up the model right in order to do that you do need to add those data attributes to the button right so for each button you need to add that data attribute so that it knows which model to all open and what it needs to toggle a modal and which model specifically okay now when we click on this uh packages in the top part
of the nav bar we should go to this section right the Browser should scroll us there so it's not doing that right now so I will go back to the nav bar I will open it up so here packages to do that we need to we need to add that here to the href so we say packages and this will actually be frequently asked questions and then I'm gonna close it again so now if I do this we we are we have a nice smooth scroll to that section okay let me close this as well
I'll close it right here and then we can continue with the one of the Final sections here the frequently asked questions with the accordion uh components all right let's continue with the the final section here in the main which is the frequently asked questions it's very similar to the packages section so we just have section here I'll give it an ID so that we can scroll to it and I'll give it a class with padding so that we don't have uh so it's not sitting right against the edge of the previous section so in here
we're Going to have an H2 as well it's going to say frequently asked questions and it's also going to have margin on both top and bottom so we have this should be a text in the center of course all right and then we're going to have that accordion component in bootstrap right so this is another complicated component that you probably should not be coding from scratch so I would just go here accordion and I think it looks pretty cool actually very modern and This is what I would copy so I'm going to copy this and
then just customize it and actually I'll just copy it from my example because it's very similar to what they show here so I'll just paste it right here and let's see what we got if we do that so we have an accordion uh component here they have an item in there and then we have the header um so you have the button in the header that's what you see here When it's not uh open right so how long are the trips that's here in the accordion header and then you have the actual body that's how
these items are structured because it has a header and then a body right and you can open them up like this I think it looks great out of the box so that's pretty cool right now I did add a custom class myself let's see yeah so I did add this class to restrain the width a little bit because by default it stretches the Entire width right so you can see this is very uh long so what we could also add here is a container and actually let's do that just to restrain the width now I
added a container I put everything in a container it's actually quite a lot of HTML so let me close that for a second all right so now the container has restrained the width but this is still quite uh wide so now on this accordion I'm also going to say the width here we have seen 100 but they Also have 75 percent of the parent element right that's how width percentages work in CSS it's always uh about the the height or width of the pairs element so now I think this is a nicer width you can
see that it's also responsive out of the box okay so one other thing by the way about these sections is that on very small viewports small devices this is a lot of vertical space right so here on the top as well so let's say that here we have padding On the top right um maybe we don't want that on smaller devices only when it when it has reached a particular width and bigger so what we can say here you can you can also do that with padding you can add those breakpoint suffixes oh let me
close this so here we have the following right so we can say add padding on the top and bottom but only when it has reached the medium break point and bigger so now you can see in Smaller devices it's it's a little bit more suitable I think it looks a little bit better and then on a wider viewports yeah so here on wider viewport we get more padding right a little bit subtle perhaps but I want to show you that you can also use these things MD on padding and margin and so on right I'll
add it here for the packages as well right and then here if can we use this yeah it works but this this is simply a browser browser feature okay so we get to the End bootstrap does not have an out of the box footer and we could cut the footer here step by step but I don't want to bore you with a footer so I'll just copy and paste it here and I'll show you what I did so I'll paste it here now we have this footer so this footer is just using a bunch of
utility classes actually so we have Aurora tours we have the display class if you want like big text you have display margin on the bottom Um we have a copyright statement it's using a text white 50 this means white text but with 50 opacity so it looks a little bit uh darker I think it looks a little bit better it's using the container class um actually not necessary I think because well it's not taking up much much width so it won't sit against the edge of the viewport anytime soon but sometimes I just add it
for any section and maybe later on I decide to change The width of of this maybe they should get a horizontal layout for example so it doesn't hurt to have it the text light text Center these are all utility classes all very straightforward background dark padding on top and bottom margin on top and bar on the top as well but we've seen other of that before right so this was an example of how you can quickly code up a complete page with a bootstrap it's using the modern bootstrap components I think they Look great these
cards look great the buttons look great model is very smooth bootstrap has really nice modern design these days and it's a great option if you quickly want to code up like a prototype website before you you know spend more resources on it you can quickly you know code up any type of idea that you have and beyond that these days what you can also do is if these components from bootstrap itself are not enough there are third-party UI kit so There are third-party UI kits they have so many components so many extra features so you
can really create complete websites by using the bootstrap grid system the whole philosophy and those components you can get them from somewhere else right so you can re you can make really sophisticated modern websites these days with bootstrap and its ecosystem so it's a very powerful tool in your toolbox as a web developer however I do want to stress that it's Important that you know the underlying fundamentals as well because there's no way around them you you're going to have some custom Styles sometimes um so make sure that you understand HTML CSS and also JavaScript
itself very well I have courses on them check them out the link is in the description by the way if this was helpful I'd really appreciate it if you could like And subscribe also check out my courses on CSS and JavaScript if you want to take those skills to an Advanced level because in there we will build some beautiful real world projects from scratch so you can see how everything fits together and really Master CSS or JavaScript and I will also release other courses from like react and node.js so if you want to be notified
then make sure you are subscribed to the email newsletter you can find the link in the description thanks for watching and I hope to see you soon