Placeholder Image

Subtitles section Play video

  • Please remember that the complete information for the class that you are about to view is at Eli, the computer guy dot com.

  • Not only do we have our videos there, but we have part lists, diagrams, pictures and even complete code examples.

  • So if you are watching this video and you want more information, please go to Eli, the computer guy dot com.

  • Welcome back.

  • As you know, I am Eli the computer guy.

  • And in today's class, I'm going to show you how to create shapes in your HTML documents using CSS.

  • So I'm going to be giving you some basic examples today that are probably a little bit of no brainers.

  • I'm going to show you how to create a square, going to show you how to create a rectangle.

  • I'm going to show you how to create a circle, and I'm going to show you how to create an oval past, that we're going to use a cheat sheet because that's what all good technology professionals d'oh when things start to get a little bit too complicated.

  • So one of the resource is I've talked about before that you should be using if you use learning CSS is a website called W three schools dot com.

  • It's very useful because they give you very specific information on how to do specific tasks.

  • And not only that, they actually have an environment where you can play around with the CSS code live, click a little run button, and then it will output the results.

  • Once we get past squares, rectangles, circles and ovals, the CSS code gets a little bit squiggly trying to trying to explain everything to you s.

  • So what we're going to do is we're just going to go over W three schools.

  • They have a lot of examples on different ways to create shapes on, so we'll just go over a couple of them there and again.

  • If you want to create a shape, there's more complicated.

  • You can just go to W three schools, figure out the shape you want.

  • Open that coat up, see what it looks like, modify it to your needs and then paste it into your project, which is what really coders.

  • D'oh!

  • Please, please.

  • There are a lot of coders out there.

  • There's a lot of newbies out there.

  • A lot of newbies out there that copy and paste.

  • Copy and paste is for amateurs.

  • When I'm a professional, I will never copy paste.

  • And here's the thing.

  • As a professional, if somebody already wrote out, all the code and I have to do is modify a couple of things, eh?

  • So that it fits into your project.

  • Why are you going toe hand type All that code when you consider plate copy paste, modify a couple of things and be done with it again.

  • It's important, understand?

  • With when you copy and paste what type of code, your copy and pasting s O.

  • If you're copying and pasting JavaScript or possibly PHP like real programming code, you do have to worry about major vulnerabilities within whatever project that you're creating, right?

  • So you just copy and paste 1000 lines of jobs.

  • Stripper 1000 lines of PHP on.

  • You don't really go through and out of that code and verify what that code is doing.

  • There may be some place in the code where it's taking all of your information and shipping it off to somebody server, so you do have to worry about that with real programming languages again.

  • Java, Java script PHP ruby on rails python that type of thing.

  • But remember, when we're dealing with CSS, all this is the style sheets.

  • All this is style sheet.

  • So worst case scenario, if you don't look at the code quite properly, the background color will be a little screwed up and you have to go in there and modify it.

  • So copying and pasting to be clear with CSS knock on fake would knock on fake.

  • It is almost always completely safe.

  • Eso again, You can go.

  • You can see what somebody else did with her style.

  • She Oh, that looks pretty.

  • Copy, Paste, Dump it into yours.

  • Do the little modifications as you see fit.

  • And now that is in your project.

  • And you didn't have to go through and figure out every specific setting S o.

  • Do you understand that every once in a while I'm going to show you examples from W three schools dot com just to be clear.

  • There, there an incredible resource.

  • I have no connection with them at all.

  • Have no idea who runs it, anything like that.

  • They're just an incredible resource.

  • And again for a lot of these projects.

  • When you start getting into how to create a trap.

  • Is oId right?

  • How to create a Travis Order?

  • How to create different types of triangles.

  • I could sit here for an hour and walk you through all of these different shapes, and then you would completely forget it anyway.

  • So if I just show you w three schools and I can say, Look, here's the 20 examples that they have.

  • If you like one of those, click on, try it.

  • Modified s see fit.

  • Copy paste.

  • That will do a lot better for everybody at the end of the day.

  • So, anyways, let's go over to the computer again.

  • I will show you with a complicated task of squares, rectangles, circles and ovals.

  • And then we'll go to W three schools just to show you some of the other shapes that you can create.

  • So here we are, back to my demonstration machine again.

  • I am using a Mac book.

  • So to write these two files, I used text edit.

  • All you need for something like this is an ass key text editor.

  • So if you're on windows, you can use no pad and Mac, you can use tax debt it in the Lenox world.

  • You can use g et it.

  • Nah, novem, whatever you want.

  • Basically, all you need is a basic asking text editor.

  • You're gonna create two files.

  • One I've called shape dot HTM l s.

  • So this is what's actually gonna be open up in the Web browser?

  • The main thing here is it has to end with dot html on.

  • Then we have, ah, shapes style, Nazi SS.

  • So this is the style sheet where all of our styling is going to come from these two documents created.

  • Let's just go take a really quick look at the HTML.

  • Then we'll take a look at the style sheep, and the HTML is very simple here.

  • So again, we open up the HTML we open up the head.

  • Then we're going to link to the style sheet relations style sheet and then the ref again as long as the style she is in the same folder or directory as the document.

  • You can simply put the name there.

  • If it isn't another folder or directory, you would have to put the full file path.

  • We're gonna close the head, and then we're going to open the body.

  • Then all I have here is just I have four different dibs with specific classes.

  • So Div is basically where you where you kind of create a section you create a division on your HTML document on Basically what we're going to do here is we're gonna create that div It is going to be a shape and then it's going to have a specific background color so it actually shows up and we can see it.

  • So I have a div.

  • The class for this is going to be a square.

  • It was gonna be a square.

  • We don't put anything within the DIV itself.

  • You could put some text here if you wanted to, but we're not putting anything because all I want is a basic shape.

  • Then we do a break.

  • They're gonna give class of rectangle, close the Tiv, give class of circle, close the Tiv Day of Class of Oval, close it.

  • If so, that's gonna give us a square rectangle circle and an oval on our HTML document.

  • Then we can go over and we can actually take a look at the CSS, and it's pretty simple.

  • A lot of this you've probably already seen before.

  • Most of this you've seen before and other classes, but this is just kind of focusing on it.

  • So the first thing that we're going to do is we're gonna create a class of square, so dot square, and then we're going to say what this class is.

  • We're gonna give it a wit of 40 pixels.

  • We're going to give it a height of 40 pixels, and we're going to make the background color gray Now.

  • It is important when you're doing these projects that you actually set the background color.

  • Because if you don't set the background color and especially if it's on a white page, then it's just gonna be white and you're not going to see it again.

  • That's it.

  • That's one of the difficult things in the coding world.

  • You can have something exist and not be able to see it at the exact same time.

  • So if you don't put a background color, you won't be able to see it.

  • So it doesn't matter what background color is.

  • Just give it once.

  • So this one I gave grey, then it created a rectangle.

  • So for this, the with will be 100 pixels will be 100 pixels wide, 40 pixels tall again.

  • I give that a background color of grand.

  • We're gonna go down to the circles and the circle in the oval.

  • This might be a little bit new new to you, but it actually uses would have already shown you in a previous class.

  • So with this literally, what we're going to be doing is we're going to be a rounding the square, right?

  • So basically, imagine you have a square, and then you're trying to around the edges of the square, and then you round the edges of the square so much that it becomes a circle that logically is literally what we're doing here.

  • So the first thing you're gonna do here is you're going to do the same thing that you did when you had a square.

  • You gotta make it a wit.

  • The 40 pixels gonna get high to 40 pixels and give it a background color of gray literally exactly what we did up here.

  • The difference is is that we're going to use the border radius s o.

  • I did a class talking about borders, and one of the ways you can format your images is by basically giving rounded borders, and that's what this border radius does.

  • And so we're actually going to give this a border radius of 50%.

  • So if you give it a border radius of 50% basically that means it rounds all the borders to the point that it turns into a circle.

  • We go down here, we take a look at the oval.

  • So oval is the exact same thing is a rectangle with of 100 pixels, height of 40 pixels, background color of gray.

  • But again, we're going to do that Border border radius two fifties percent by setting it to 50% is going to round the border radius so it turns into an oval.

  • We go over and we actually take a look at the demonstration.

  • This is then the example that we get So so this is our square again.

  • It's great.

  • All of these air gray 40 pixels by 40 pixels, right rectangle 100 pixels by 40 pixels.

  • Now with the circle, if you can kind of tell, you'll notice the height and the width of it is actually 40 pixels.

  • But the border radius has been rounded to such a degree.

  • That is now a circle.

  • Same is then true with the oval in regards to rectangle.

  • So basically, this is still 100 pixels wide by 40 pixels tall.

  • But you have rounded the border radius to the point that it now looks like an oval.

  • If we go back just to give you a little bit of example for how this would work, let's say I only set the circle to 25% for the border radius I could file.

  • I could do save, and then this might be something you're a little bit more accustomed to.

  • So basically see.

  • So what this is is this a square with rounded borders and all we're doing as we increase the percentage of the rounded borders were just slowly, slowly, slowly turning it into a circle.

  • Right?

  • So do 50%.

  • Then we do file, you save.

  • We now have a circle.

  • That's all we're doing here again.

  • If we go down to the border radius for the oval, let's just say that to 25% to give you an idea.

  • We do save.

  • We do refresh, See, now it's a rectangle with rounded borders.

  • Essentially, that's literally all we're doing here.

  • We're just rounding the borders to such a degree that it then turns and to an oval.

  • So those are the basic examples of square a rectangle circle and oval past that, though past that, To be clear, you could do a lot more really cool things.

  • That's where you go to some sight like W three schools dot com Again, one of the things you have to remember encoding is that once you create a basic way to do something, other people can simply copy and paste it again.

  • There's no reason to reinvent the wheel all the time.

  • And so again, that's what That's why I recommend you have a book where you could go to something like W three schools because then you can have an idea in your head about what you want to do with CSS, and then you could just go on research it and see if somebody else has done it like you may be sitting here going, But hell, I don't want a rectangle.

  • I want a trap is oId so I can go here and I can click on this.

  • Try it for yourself, button and this gives me the trap is all right.

  • So basically, the important thing here is we're creating class for trap is oId.

  • We're doing a border hyphen, bottom 50 pixels.

  • Solid of this will be great color border hyphen left, 25 pixels.

  • Solid, transparent border hyphen, right, 25 pixels.

  • Solid, transparent height.

  • Zero with 125 pixels.

  • And so what you can do here is you can go when you can start playing around.

  • Let's see if we did the bottom board or we turn it to 150 pixels and then we can click the run button and we can see that's what it turns into.

  • Then we can get rid of that.

  • No, no, the left.

  • What if we made the left 125 pixels and then that's you know.

  • Then you can start.

  • You can start going through here and tweaking things and figuring out what you actually want it to look like.

  • One of the interesting things to realize here is he, with his border left in this border, right?

  • You're actually creating borders, and when it says solid, transparent, The interesting thing here is that this is actually a color so in order to make the shapes, what's happening is you kind of create a shape, and then you're chopping off bits of the shape.

  • It's kind of like doing layers.

  • And so when the interesting things you can do here to life, I changed us to solve it red, and then I do run.

  • You can now see that this is the border that's been created, right?

  • So if I go down here on the border, right, let's say turn, turn it to green.

  • You can see that's the border that's been created.

  • Basically, we're normally doing here in order to create the shape is you simply said it Thio, Trans parent, Let's make sure I don't do that.

  • You said it's a transparent, so you don't actually see that border.

  • So that's one of things to be looking at here again.

  • You can go down.

  • They have things like triangles.

  • Triangles may be important for you.

  • For whatever project that you're doing, Um, it again, let's a right triangle triangle.

  • You create an arrow, try it for yourself.

  • So basically the important thing here is you're creating this class triangle hyphen, right?

  • You'll notice the with zero.

  • You'll notice the height of zero, but then border top bought, border left and border bottom.

  • These are the settings that then create this triangle.

  • So if I want to do border left, if I wanna extend this out, I could make make this a larger triangle.

  • So see you then that becomes, you know, larger triangle for you.

  • Or, if I want to, like, skew the triangle into a bit of a different direction.

  • I can modify that way.

  • And so this is This is one of the things, and again, this is what you could do is a real coder.

  • You can sit here and play around with all this stuff on w three schools dot com, and then all you have to do is you can simply copy, copy and paste.

  • Put it onto into your project, and away you go.

  • And again, that's one thing, especially with shapes.

  • What's really nice with W three schools is you can just sit here and play with all of this and figure out what what probably is going to work best in your project.

  • It's very easy to play with here.

  • You don't have to go through multiple documents or any of that.

  • You know what to do.

  • Save, refresh.

  • You just plug things in, see what works for you.

  • And then again, I say copy and paste.

  • So w three schools for the rest of these shapes again, if you want to trap.

  • Besides, polite parent parallelogram is triangles, so on and so forth.

  • So there you go.

  • Now you know how to create basic shapes and CSS for your HTML documents.

  • Again, basic shapes could be very useful just as graphical flourishes in your HTML document when you want to get more complicated with these shapes, doing things such as creating cards or creating some kind of basic diagrams with these shapes are things that you can d'oh again to make it easier for your users, for your visitors to be able to be, understand the information that they're being presented with.

  • One of most important things I do want you to take out of this lesson, though, is that professionals do copy and paste.

  • There's this weird.

  • I don't know what it is.

  • I don't know what it is with new people.

  • New jobs out there.

  • They're like I will never copy and paste I what What Why not?

  • If somebody just rode out 10 lines of code or whatever in order to accomplish a specific task and that that's a task that you need to accomplish?

  • And all you need to do is like modify a couple of settings to make it work.

  • Why are you going to type all of that out just to prove that your professional or something?

  • The reality is, and this is very important.

  • Understand?

  • In the technology world, by and large is that you cannot remember everything again as somebody who started in technology before Google is what Google is today.

  • Before so many things were searchable, Let me tell you half into actually memorized almost everything in your job sucks.

  • I didn't do that back in the day.

  • I remember back in the day when I became a nightie professional.

  • Microsoft used to have this have this program called technique, right?

  • So TechNet gave you all the software that Microsoft created so that you could test it on.

  • Then they will give you their white pages.

  • So basically the idea is all the research, all the information they had on the projects, that was something that you could pay for you paid $400 a year for access to all those documents.

  • Yeah, this was This was before everything was completely Internet based on.

  • So basically, what you would get is you would get stacks of CDs, and then one of those CDs would be the index CD.

  • So if you had a question about setting up around in with the Windows NT four server or something like that, you literally put the index CD into your computer.

  • You would type.

  • You're certain it would give you the results on what CD to pop in so that you can actually read the document about whatever it is that you're trying to accomplish.

  • I remember those days those day sucked with their bad times.

  • It was not a good time to be attack on the modern world when you have Google.

  • When you have Google, when you have the ability to very easily copy and paste do it right, it allows you to be able to be far more productive than trying to believe.

  • You can remember every single one of these settings and then be able to spit it out accurately whenever you need it.

  • The fact of the matter is, whatever you're gonna be creating a project, there gonna be a lot of weird things coming up again?

  • Why would you need a trap?

  • Is always like, Why?

  • Why do you need to memorize how to create a trap resort and CSS?

  • How often does this come up?

  • But if you know that when it does come up at some point, you can just go to W three schools or something else again, copy paste code, dump it into your project in a way, Ugo, then that allows you to keep your rolling through the project without having to learn something that it's not gonna matter.

  • At the end of the day that you have memorized the important thing to understand, though, when you start doing copy and paste and this is important when I was talking about doing this with CSS versus other programming languages is that you do need to be ableto audit the code.

  • There's a difference between writing the code and reading the code.

  • It's kind of like it's kind of like understanding a foreign language, right when you go to a foreign country, many times is more important that you understand what people are saying then being able to save yourself.

  • If you understand what they're saying, you can probably find a way to communicate with them to get something accomplished.

  • But it's very important that you understand what they're saying.

  • And so when you were looking at the code, the important thing to understand before you copy and paste is that you can read the coat right.

  • You don't have to type out if you've got 10 or 20 or 100 lines of code.

  • There's no reason to re type out the exact same code.

  • But you do.

  • I need to be able to read what the code is doing and understand exactly what it's doing so that you verify that you're not putting vulnerabilities.

  • You're not putting some kind of weird ass hack attack or something like that into some kind of production system that you're gonna be putting out to the world.

  • So again, it's not necessarily important that you're actually able to write guess for memorization the code.

  • It is absolutely important that you can read the code and being audited and understand more or less what's going on.

  • So that's one.

  • The big significance is with copy and paste.

  • Copy and paste.

  • Absolutely valuable in the coding technology world in general.

  • But just make sure you can on it.

  • And that's where things like maybe three schools.

  • It's very useful because again, I love W three schools for things like shapes.

  • Just go there.

  • You can tweak all the sad things you get something that more or less looks right.

  • You copy and paste.

  • It's your project.

  • Do a couple more tweaks and away you go far, far more productive than having todo basically relearn how to create a triangle every single time that you need to do it.

  • So anyway, I hope this is this class was useful for you and look forward to the next one.

  • If you like the content that I create, please think about going to align the computer guy dot com and becoming a member or donating.

  • Please understand that all the educational videos are in front of the pay wall that includes the videos that includes the notes, the diagrams and the code.

  • Example.

  • All of that is freely available and in front of the pay wall.

  • But if you want to watch opinion videos, or if you want to be able to comment.

  • You do need to become a member.

  • Membership is $5 a month or $60 a year and gives you access to those opinion videos and the ability to comment.

  • If you don't want to become a member, you just want to give a one time donation.

  • There is also a donate button where you can do that.

  • Please understand.

  • In order to provide the education that I am.

  • It does cost money, servers, cost money, equipment costs, money, travel costs, money.

  • All of these things cost a reasonable amount of money.

  • And the fact of the matter is, is YouTube's advertising program no longer supports creators the way that it used to.

  • So if you want to these classes to continue to stick around and you find them to be valuable, please think about either becoming a monthly member or donating a few dollars for this project.

Please remember that the complete information for the class that you are about to view is at Eli, the computer guy dot com.

Subtitles and vocabulary

Click the word to look it up Click the word to find further inforamtion about it