
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Use an Image in a Webpage
To use an image on a webpage, use the <img> tag. The tag allows you to add image source, alt, width, height, etc. The alt is the alternate text attribute, which is text that is visible when the image fails to load.
The following are the attributes −
Attribute |
Description |
---|---|
Alt |
The alternate text for the image |
Height |
The height of the image |
Ismap |
The image as a server-side image-map |
Longdesc |
The URL to a detailed description of an image |
Src |
The URL of an image |
Usemap |
The image as a client-side image-map |
Width |
The width of the image |
Just keep in mind the <img> tag has no end tag.
Example
You can try to run the following code to use an image in a web page in HTML
<!DOCTYPE html> <html> <head> <title>HTML img tag</title> </head> <body> <h1>Tutorialspoint</h1> <h2>Simply Easy Learning</h2> <img src="/https/www.tutorialspoint.com/green/images/logo.png" alt="Tutorialspoint" width="260" height="100"> </body> </html>
Advertisements