02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

Working with The IMG Tag

Attributes: what are they and how to work with them in HTML.

Relationships: Just like in the real life we think we are free but we belong to others. If its to our government that want's our money, our family that wants our love or our time that our bosses kind of own... In this video we understand how this idea of relationships work in HTML.

One of the most important things you need to notice at first is understand when something should be an attribute and when should it be a tag. The answer to this question for the most would be the answer to the question Does it belong to something or should it be in it. In our example a person doesn't belong to a car but is in it while a color of a car is part of the car and as such belongs to it.

By the end of this video you will know how to add new images. A site without an image is like a cat without fur... That's just sad. So let's add your pictures of your cat into your site and make the world a better place. We will learn our first Attribute the src attribute and set inside of it the actual location of our image.

Video Transcript

00:00Welcome back , we just learnt about attributes in a theoretical way, we gave an example of a car
00:06and we said that as much as a car has people inside of it, they are nested inside of a car,
00:12they're in the car, in the same way 'b' tag is inside of a paragraph,
00:20Contrary, when we want to say that car is blue, we wouldn't nest that inside of the car,
00:25we'd put that as an attribute of the car. We'd say that this car is blue,
00:30and that is basically the relationship, so when you ask yourself sometimes if this should be inside
00:34or should this be an attribute, really a lot of times the question is a question of belonging
00:39Does this belong to it or is this inside of it?
00:41and that would 99,9% answer the question of: should it be an attribute or should it be a property?
00:48Let's start with our image property and if you go into HTML source file you'll find one of our banners
00:56which is going to be cheap thrill xml, which is literally a promotion to one of our features of the month
01:02Learning doesn't have to be a cheap thrill,
01:05We really want that to be a part of our blog post, we want people to see our banner
01:09to do that, we have to add a new attribute which is called images,
01:13I'm going to go into image tag and let's find where do we want to put it. I'm going to put it right after
01:17the headline. I'm going to put here a new image tag, and I'm going to self-bound it because it doesn't contain
01:23anything inside of it. Now I have to say to it what image is it ?
01:27Just as much as I would say what car is it ? The image itself is not inside of the image tag,
01:33The image is basically it. It was just telling it what it is,
01:37To do it, we're going to put here a space and we're going to put an attribute that is called 'source'
01:42'src' equals, and then we're going to say to it where is the file,
01:47Now, if we look into our HTML itself right now, we'll see that our file is in exact same folder as our html file,
01:55so all we really have to do is type inside of here, the actual location of the image,
02:00I could just come right here into the source, paste the actual location of the image, click on save,
02:07once I've done that , I'm basically done,
02:10If I go into my html and click on refresh, now we're going to see our banner befre we see our text

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!