Transcript for:
Understanding XHTML and HTML5 Differences

this lesson so in this lesson will be a little bit uh quick i will say i just gotta mention a few different between the xtml and html5 okay so um in x html we definitely need to specify the dot type okay just remember that the dot type is is not a tag first and also just tell the browser what type well what version of html you're trying to use like what are you trying to use um you can tell that like you're trying to use xtml or you can tell the browser to um to trick this file as um html okay so the second thing that xtml has is that the x mlns attributes in the html it has to be mandatory all right the other one is that xml the head tag the title and the body tag are also mandatory and you know i'm gonna show you some examples right now the also the elements must be properly next like you will see that as well and of course element must always be closed and again all these things have to be um are mandatory well yeah strict i would say um in html okay also the elements might have to be in lower case uh the attributes as well and so on so let me show you some examples right now so here i have my x html that hdmi and on this side i have my html.html okay so as you can see the doctype this is the first thing that you should see is here what do you use to specify the x html okay especially this part right here will tell you that it's xtml okay so when the browser take the file and they read the file they will notice that here what you're trying to do here is using the xtml okay on the other hand we have the html5 tag which is only this which is all it says the doc type space html okay as you can see this is a bit of improvement like imagine you have to type well not thai because you're probably going to be like copy and paste um if you have to do this every time all right but now is just go here and just type this okay um so what i was trying to say is here in x html this is not acceptable if i type like you know p well let me put the a i'm gonna put a and you know my link and then i just close this stack here let's say that i just put in a lowercase a but then i come here and i use the edge preference here so according to uh the document that i just show you um this is not allowed again it could work in modern browsers like for example you know we are in 2020 right now and browsers are like they are super smart you know so yes it will definitely work but again your goal is to um to write well code you like well-reading code um you know when other other person from your team they will take a look to your code they know what they are reading is correct you know so you should not be worrying too much about what what is the final result but also make sure you know you need to make sure that your code is following um the appropriate structure to you know so other people can definitely identify what are you trying to do right so this is not available i mean not not available not acceptable and let's say here okay um i talk about let me let me just go a little bit on to the powerpoint but you will see it at the end you will see uh something funny um element must be always been lowercase i just show you that and yeah this should be like properly i will show you this one right now and attribute value must always be quoted okay and all right so all right so let me just go back to it and it's funny how the x html have all these rules okay but let's go to html5 so i'm here i'm going to write a website and you know this is my first website and i'm just typing things and i'm just saying you know this is my link and you know i didn't put anything here but that's okay you don't need to all the time i'm just gonna add this but then just type you know you start typing this and then you do this and you know what i will i will even delete this body tag because i don't like it okay so this one is open but this one is not closed and i'm just gonna close you know save my file and just go ahead and run my file here which is my html here there you go it works you see what i'm saying it's like um it's funny because again i'm trying to teach you that you need to write well struck um html code but because this browser today they are so smart they don't they they will display something they will not mind they will definitely show you some results probably not the one that you expecting because for example here if i'm trying to make this team bold let's say that i'm trying to use um what exists okay what is my text there you go if i'm trying to let me just put this thing down my html there you go is some if i'm trying just to make this bold using db tag and i'm going to save this file just go back to my browser you see it works i'm not even closing the tag and he knows that if i'm using um this tag here which is the bold tag it's it's it knows he knows what i'm trying to say see that so this would be the proper thing also imagine if i put what else let me see something crazy that it could happen on this side so i'm closing my body tag and just pull like b capital b and capital y just like this say that and nothing's happened it's still working so html5 today 2020 is basically um powerful so that's this is why you definitely have to pay attention to your code because most of the time you probably won't you know forget to close something or probably just make something around for example you probably might have something here that is a ptac and probably closing this big tag here and who knows it was a work there you go still working but we know this is not appropriate to do it so um this is why you need to have a little be careful you need to be careful you know you need to be careful with the xml compared to javascript um javascript even if you uh well i don't want to talk about javascript in this lesson but uh what i'm trying to say is javascript if you make a little mistake we'll definitely stop you there x html same thing um this is not correct it would have you would definitely see it somewhere okay right now and again because the browser is so smart they will it will work no matter what i do wrong it was still working but the you know the rules that this thing has it's like you need to follow the prop the appropriate instructor to do this um and again every time you you writing code you should not think about yourself only it's not like about oh this is my code nobody will see it and you know i can do whatever i want that's wrong definitely every time you think you start writing code uh the first thing that you should be doing is make sure that everything is correct at least every tag um and again i'm talking about any programming language any code any type of code you want you want to um do right um and also you should also be adding some comments like for example this is my body oh well you're not going to type this is my body tag but you know just some comments to describe what you're trying to do um especially when you're using classes we're going to get to that and yes um all right yeah let me see what else from here and again even with all my html that this thing could work let's see never tried this one before though to be honest with you but let's see ah that one didn't work ah so he knows when you you're missing the html let me try that before honestly but yeah so you definitely need your html because this is what is tell the browser that is this is a website so probably when they see this and again this is not telling the browser that this is a website this is just telling the browser that what type of html or what version of html you're trying to do okay here and again you specify um x html this is for the um for the html5 and the one that i showed you in the past lesson i will show you for html4 which is this one right here so if you're going here it's going to go ahead and copy and paste it and you might have something like this so this one is to specify the browser that you're trying to use on html4 so i will see you in the next lesson