- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to display an image in HTML?
59 Lectures 8.5 hours
68 Lectures 8 hours
Use the <img> tag in HTML to display an image. The following are the attributes −
|Deprecated− Specifies the alignment for the image.|
|Alt||text||Specifies alternate text|
|Border||pixels||Deprecated − Specifies the width of the image border.|
|crossorigin ||anonymous use-credentials||It allows images from third-party sites that allow cross-origin access to be reused with canvas.|
|Height||pixels or %||Specifies the height of the image.|
|hspace||pixels||Deprecated − Amount of white space to be inserted to the left and right of the object.|
|Ismap||URL||Defines the image as a server-side image map.|
|Longdesc||text||Deprecated − Specifies a URI/URL of a long description - this can elaborate on a shorter description specified with the alt attribute.|
|Src||URL||the url of an image|
|Usemap||#mapname||Defines the image as a client-side image map and used alongwith <map> and <area> tags.|
|Vspace||pixels||Deprecated − Amount of white space to be inserted to the top and bottom of the object.|
|Width||pixels or %||Sets the width of an image in pixels or in %.|
You can try to run the following code to add an image to a web document −
<!DOCTYPE html> <html> <head> <title>HTML img Tag</title> </head> <body> <img src = "https://www.tutorialspoint.com/html5/images/html5-mini-logo.jpg" alt = "Learn HTML5" height = "250" width = "270" /> </body> </html>
- How to display an image in JavaFX?
- How to Insert an Image in HTML Page?
- How to make an image responsive in HTML?
- How to use an animated image in HTML page?
- How to specify an image as a client-side image-map in HTML?
- How to create clickable areas in an image in HTML?
- How to use an image as a link in HTML?
- How can I display an image using Pillow in Tkinter?
- How can I display an image using cv2 in Python?
- How to load and display an image in ImageView on Android App?
- How do we create an image map in HTML?
- How to save HTML Canvas as an Image with canvas.toDataURL()?
- How to create an unordered list with image bullets in HTML?
- How can I display an image inside SVG circle in HTML5?
- How to load and display an image on iOS App using Swift?