From the course: Simplifying Web Development with Accessibility Best Practices
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
The img element - HTML Tutorial
From the course: Simplifying Web Development with Accessibility Best Practices
The img element
- [Instructor] The img element is an inline replaced element used to display a supportive image file within a container. It has two required attributes; source which holds a URI to the image file location and alt which holds the alternative text provided if the image is not displayed. It also has a series of optional attributes, including width and height to tell the browser of the proportions of the image before it's loaded, source set and sizes to provide the browser with responsive images options and loading for native lazy loading. A good rule of thumb when using the image element is to always define the source, alt, width and height attributes and also take advantage of source set and sizes anytime you're working with large images. It's also standard practice to declare a Global CSS reset for the image element. Display block width 100% and height auto. Now there is a more modern CSS remedy which displays the image…