From the course: HTML: Images and Figures

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Using the img element and src attribute

Using the img element and src attribute - HTML Tutorial

From the course: HTML: Images and Figures

Start my 1-month free trial

Using the img element and src attribute

- [Instructor] Here are the essentials of adding an image into an HTML page. Use the image element with the source, SRC attribute that gives the path to the image file. The image element is an empty element. It doesn't have any content and it doesn't have a losing slash image tag. In some XHTML5 documents, which is flavor of HTML5 based on something called XML you may see a notation like this with a slash greater than at the end. This is the XML way of saying this is a beginning and ending tag all wrapped up into one. Here's a diagram of the project structure which you will find in the exercise files that accompany this course. The folder will contain the necessary HTML and possibly CSS files along with a directory named images that will contain any of the images needed for the project. In this case, we're putting the image element into the index.html file so the correct relative path to the image will be images/teddybear.jpg. Here's the HTML for the web page. In the body of the…

Contents