Hi there, this video is all about learning the absolute fundamentals of what HTML is, versus what CSS is. You can skip this if you've got a basic understanding. We're going to do some real simple stuff here. We're going to add some HTML tags, it would look like that. And then we'll style them using CSS. And it will look like, oh, here we go. Ah, that. Better, or worse? But you get the idea. We're going to do HTML, and then make it look pretty using CSS. Let's jump into the video and learn out how.
To get started we're going to type our HTML first. So this word 'Hello World', is not HTML. It's just some plain old text we typed in; delete that. So when we write HTML we need to follow some syntax. So we're going to put in something called a Heading. And in this case, Heading1, the most important heading on our website. And in HTML it uses the abbreviation of H1. Now we can't just type H1, we need to wrap it up in angle brackets '< >'. So open angle brackets, H1, and then close angle brackets. '<H1>'.
So you can see it there, it did a couple of things. We typed in our H1, we put the brackets either side, and you'll notice that VS code automatically put in this extra closing tag. So that's how HTML works. It's a wrapper tag. It's a tag that goes around the beginning and the end, and everything in the middle, this is my heading. 'Heading1'. So as long as there's H1 on one side, on the other side, the wrapped in angle brackets.
The closing, you'll notice has this, that forward slash, '/'. And that tells the browser that this is my heading. All right, let's save it. Let's check it in Google Chrome. And you can see there. 'Refresh'. I've got my Heading1, it's big, it's bold, it is Times New Roman, it's black. That is a default setting for our Heading1. Let's add a couple of other HTML tags.
So in here we're going to put a 'Return' in. I'm going to type angle brackets, H2, close them. You'll see it puts in the extra syntax. If it doesn't, for whatever reason, you can just type it in. So I'm going to start typing. Oh, it really wants to help out. Thanks, VS code. This, let's just write 'Heading2'. So those are a couple of real basic HTML tags.
Another really common one is a P-tag. So angle bracket, P, close it off, '<P>' And this is, like a body text. Often you'll have a lot-- you'll have probably just one H1 on your page, but you'll have lots of different paragraph text, because it's the body text. Save it, check it in our browser. You can see, these are the default styling for those three tags. To override the styling, that's where CSS comes in. So what we need to do is, our HTML is kind of like things on the page, and our CSS is the styling of those things in the page. To make this work, let's put a couple of returns at the top here, and type a tag called 'Style'. Close it off, and again it puts in the closing tag.
What I just did there is, I put in a few returns. Returns don't mean anything in code, you can have a million of them. It won't display on the page. I just use a lot of returns when I'm styling things. Just gives some sort of visual breaking up of different parts, rather than trying to cram them all together. Because what you'll notice down here, is if I delete this, I'm just bringing it up, so all in the same line. If I save it you'll notice, back here in Chrome, it's exactly the same. So it doesn't matter whether you put returns in here or not, except that it looks hard to work on.
So in this Style tag, this is where our CSS is going to go. And CSS has a different type of syntax. Whereas HTML had an opening, closing angle brackets and a forward slash there, the CSS, you do things like this. You say, I want the H1, this is called the selector. I'm selecting the H1. Then you put it in a space, and then put in the curly brackets, rather than the angle brackets. I'm going to put a return in my curly brackets, just to separate it out, not for any good reason, other than it looks a little bit more easier to communicate to you. And in here I'm going to do some H1 styling.
We'll start with color. We've got to spell it the American way, 'color'. And after this, this is the property. So Selector, I'm selecting H1, I want to add the property color to it. It needs to end with a colon, ' : ' And then you pick a color, there's lots of default ones in there. I'm just going to put a space in, and type 'red'. And at the end of CSS, you have to have a semicolon, ' ; '
So curly braces, colon, semicolon. That is the syntax, pretty much for all our CSS; pretty simple. Save it, and let's see if it works. Let's jump into the browser. 'Refresh'. And look at that. H1 is styled. Now I know this is not a huge amount we're doing here, but I'm excited. I'm excited for you. I remember learning this stuff, and it was, I don't know, a revelation. So let's do something else. I'm going to put a return in here. And so if you want--
We're going to group CSS. We want to do a few things to the H1. So as long as it's within these curly braces, we can type in something, like font, I'm going to put in 'Font Style'. You can see, VS code really wants to help you kind of suggest things. Like, Size, Style, Display. I'm going to use 'Style'. I'm using my mouse now instead of typing it in. That's just one of the little helpful things you can do with VS code, or you can use your arrow keys on your keyboard. Can you see that little blue line moving around? Go there and hit 'Return' on my keyboard. We've got almost all of it.
So we've got our Property, there's the colon. We've got our actual value, which is italics, and what goes at the end? You got it; semicolon. Let's hit 'Save', let's see what it does. Let's hit 'Refresh'. Ah! It's italics, and it's red, and it's an H1; brilliant!
So I'm going to set a class exercise now. I want you to change this H1 to be a font size of 100 pixels, or px. I'd like you to pause it right now. Go, hit the button, and I want you to see if you can do that. Font size at 100 pixels, give it a go. I'll give you a hand in a second. Pause, go.
All right, you may or may not have paused. You may or may not have made it work. Let's see if you followed me. So 'Font Size', here we go. Got a colon, then put in 100. And what people often forget, is you need the px. And we use pixels when we're dealing with fonts at the moment. And what goes at the end? Semicolon. Save it, back into here, refresh. Oh, look at that; giant H1.
All right, let's style the H2 together. And then I'll set another little exercise. So 'H1'. I put a couple of returns in here. Curly braces. You can kind of separate them up using these kind of, the selector. Then the curly brackets. And everything goes in the middle, that you want to do to that particular selector. So in this case we're going to do a color of blue. Semicolon. And we'll do a font size of 50 pixels. So give that a go now, and I'm going to set a verbal exercise.
I want you to try and do the P-tag. All by yourself, I want you to make it green. And I like to have a font size of 20 pixels. Give it a pause now, see how you go, and pause. All right, how did that go? I hope you did well. Let's follow it together, P-tag, curly braces. Color of green; there's a few different greens. Yellow green, green yellow, that's my one. Semicolon, and we're going to put in a font size of 20 pixels. Semicolon, 'Save'. Back into here, 'Refresh'. Look at all that good stuff.
So it's just an introduction to what HTML is, and what the syntax looks like. These are these guys down here. And the styling of them. We talked about selectors. I use the kind of nerdy words here so that becomes a bit more natural for you. So, selector, this is the attribute, no, that's the property. And that's the value of that property. And that's the basics of websites. We're just going to expand on that, and we'll build some boxes to put this stuff in. We'll start doing some interactive bits and pieces, but yeah, that's the fundamentals of HTML in CSS. Let's jump into the next video.