1 00:00:00,700 --> 00:00:04,220 Images draw users in and bring color and life to your pages. 2 00:00:04,220 --> 00:00:07,220 Designers and developers use images to display logos, 3 00:00:07,220 --> 00:00:10,930 avatars, photographs, illustrations, charts, and more. 4 00:00:10,930 --> 00:00:13,290 Browsers support several image formats and 5 00:00:13,290 --> 00:00:17,540 the most common ones you'll use are JPEG, GIF, PNG, and SVG. 6 00:00:17,540 --> 00:00:20,390 You can learn more about these image formats in the teacher's notes 7 00:00:20,390 --> 00:00:20,950 for this video. 8 00:00:20,950 --> 00:00:26,970 And the JPEG format we're using in our project is commonly used to display 9 00:00:26,970 --> 00:00:31,890 imagery or photographs that contain great detail in many different colors. 10 00:00:31,890 --> 00:00:37,350 Now to keep your files organized, it's best to place images in a separate folder. 11 00:00:37,350 --> 00:00:42,340 So let's go over to File, New Folder to create a new folder, and 12 00:00:42,340 --> 00:00:45,630 we'll name this folder img or image. 13 00:00:45,630 --> 00:00:49,099 Now drag all three image files into the image folder 14 00:00:56,120 --> 00:01:01,216 Next let's add the featured.jpg image to our page 15 00:01:01,216 --> 00:01:07,060 by including it inside the intro div here in index.html. 16 00:01:07,060 --> 00:01:11,620 So the image element represents an image in the document, so 17 00:01:11,620 --> 00:01:14,380 let's add an image tag above the paragraph. 18 00:01:14,380 --> 00:01:19,340 Now the image element is considered an empty element, meaning it 19 00:01:19,340 --> 00:01:24,070 does not contain any child content and it doesn't have a separate closing tag. 20 00:01:24,070 --> 00:01:27,470 And the image tag requires a source attribute, 21 00:01:27,470 --> 00:01:31,050 and source lets the browser know the location of the image. 22 00:01:31,050 --> 00:01:35,005 So the value needs to be the path to the image you want to display and 23 00:01:35,005 --> 00:01:39,190 featured.jpg is located inside the image folder. 24 00:01:39,190 --> 00:01:46,602 So as the value for source, we'll type the relative URL img/featured.jpg 25 00:01:52,523 --> 00:01:57,181 Now image elements need to provide the browser a text description of 26 00:01:57,181 --> 00:01:59,503 the image via the alt attribute. 27 00:01:59,503 --> 00:02:04,040 The alt attribute is an important accessibility attribute that displays 28 00:02:04,040 --> 00:02:08,320 replacement or alternative text to users when an image is not available. 29 00:02:08,320 --> 00:02:13,160 So for example, if the image URL is wrong or if the image format is not supported by 30 00:02:13,160 --> 00:02:15,920 the browser or if the image is not yet downloaded. 31 00:02:15,920 --> 00:02:20,710 And some users also disable images in the browser to save on download costs. 32 00:02:20,710 --> 00:02:22,460 So adding alternative text for 33 00:02:22,460 --> 00:02:26,730 images is required to make your site more accessible to users. 34 00:02:26,730 --> 00:02:27,990 It's a best practice. 35 00:02:27,990 --> 00:02:32,410 In addition users with visual impairments use assistive technologies like screen 36 00:02:32,410 --> 00:02:34,250 readers to read webpages to them, 37 00:02:34,250 --> 00:02:39,030 and the contents of the alt attribute is read by these technologies to users. 38 00:02:39,030 --> 00:02:43,464 So it's important to write alternative text that describes the contents of 39 00:02:43,464 --> 00:02:46,592 the image and that helps describe the image to users. 40 00:02:46,592 --> 00:02:51,988 So for example, I'll set the alt text of my featured image to Virtual reality user. 41 00:02:55,188 --> 00:02:57,651 You can learn more about tips for writing good and 42 00:02:57,651 --> 00:03:01,310 meaningful alt texts in the teacher's notes of this video. 43 00:03:01,310 --> 00:03:05,950 So now, let's add an image to the about section of our page. 44 00:03:05,950 --> 00:03:13,402 So we'll include an image tag right below the about paragraph, 45 00:03:13,402 --> 00:03:18,784 and let's set the source attribute to the path 46 00:03:18,784 --> 00:03:26,820 img/vr-space.jpg. Now we'll give the image some alt text. 47 00:03:26,820 --> 00:03:33,204 So I'll add an alt attribute, and set the text to user experiencing space in VR. 48 00:03:41,045 --> 00:03:42,127 Now by default, 49 00:03:42,127 --> 00:03:47,704 the image element displays an image using the inherent dimensions of the image file. 50 00:03:47,704 --> 00:03:54,263 So for example, featured.jpg is 300 by 300 pixels and 51 00:03:54,263 --> 00:03:59,572 vrspace.jpg is 500 pixels by 327 pixels. 52 00:03:59,572 --> 00:04:03,988 Now if you wanna add additional information about an image to your users, 53 00:04:03,988 --> 00:04:08,030 you can include a title attribute inside the image tag. 54 00:04:08,030 --> 00:04:12,084 So for instance, right after the alt text for the about image, 55 00:04:12,084 --> 00:04:15,525 we'll add a title attribute and inside add the text, 56 00:04:15,525 --> 00:04:21,108 Virtual reality users can explore faraway places 57 00:04:26,556 --> 00:04:30,026 and feel as though they are right in the middle of the action. 58 00:04:36,531 --> 00:04:41,142 So we'll give this a save, refresh the browser, and you'll see that most 59 00:04:41,142 --> 00:04:45,990 browsers present this information to the user when they hover over the image. 60 00:04:45,990 --> 00:04:49,447 And this is refer to as a tool tip. 61 00:04:49,447 --> 00:04:52,500 All right, so now that you've had practice with file paths and 62 00:04:52,500 --> 00:04:59,165 adding images into the page, why don't you include the vr-user.jpg 63 00:04:59,165 --> 00:05:03,898 image inside the article file in the 2017 sub-folder here? 64 00:05:03,898 --> 00:05:06,367 And you can see how I added the image in the next video.