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

Creating HTML and JavaScript Image Maps

Creating HTML and JavaScript Image Maps. The first step is we are going to add a new image into our HTML page and define its rules in CSS. Once done we will create our first image Map. Talk about advance things.

Video Transcript

00:00Alright now we're starting something now that we know a little bit of programming
00:03We're gonna do a live example of programming with JavaScript and introduce a new HTML
00:09Tag and that tag is gonna be image maps to create an image map
00:13But I first need to have an image so to do that if you go into your source files and again
00:17If you don't have them go to zero to geek calm and download your source files
00:20You'll see I created a image called colors that PNG now with my image colors that PNG first of all
00:27I have your my base image. It has our regular CSS inside. It has an empty JavaScript tag
00:33It has a linkage. We want to link it to that script tag
00:38Right, so we have an empty clean fresh beginning the next step that I want to do in line 10 is I want to add
00:43It that image. I'm gonna write their image source and write the name of the image
00:49Which I believe was colors that PNG. Let me just double-check that
00:52Yep colors that PNG and I'm gonna save that once I go back into my browser click on refresh
00:58I should have my image here. Oops. I'm not in the right HTML. I'm not in the right version of my file
01:04So let me just load up the latest file and we have your our image
01:08So I'm just gonna add a little bit of styling to our image before we continue
01:12I want to add a nice little border around our image. All right, so to do that
01:16I'm gonna go back into my application again go into my style. I'm gonna just add a new image
01:22property in CSS
01:24And I'm gonna say to that
01:26I want to set its border property and I'm gonna say that I want my border to be 2 pixels in
01:31With and I want it or girth or whatever you want to call it. I want the border to be dotted and
01:37I want it to be the color white which in our case is
01:41FFFFFFF which counts for white and then a semicolon once I save that go back into my application and click on refresh
01:48We'll see that we'll have a nice little two dots, right? Now the next step is image map
01:54So let's see how image maps work
01:56All right
01:57So first step is I'm gonna go back into my code now that we have an image go back into my HTML in the next line
02:03I'm gonna create a new map and I'm gonna give that map a name. So let's call it a name such as my map
02:10So that's it. I have a net I have a map
02:12It has a name the next step now that I created a name for my map is I want to link that map
02:18With this image the way I link the map with the image is by using the word use
02:24Map inside of my image and I tell it which map I want to use
02:28I want to use the map using the number hashtag and then my
02:33map, so now I linked my map and my my mapping and my image together

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!