
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
How to 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="/green/images/logo.png" alt="Tutorialspoint" width="260" height="100"> </body> </html>
- Related Articles
- How to use .svg files in a webpage?
- How to set background image of a webpage?
- How to use an image as a link in HTML?
- How to use an Image as a button in Tkinter?
- How to use JavaScript to load a webpage after 5 seconds?
- How to use JavaScript to redirect a webpage after 5 seconds?
- How to use an animated image in HTML page?
- How to Generate a PDF from an HTML Webpage?
- How to use an image for the background in tkinter?
- How to add an audio player to an HTML webpage?
- How to embed an interactive Matplotlib plot on a webpage?
- How does one use Glide to download an image into a bitmap?
- How does one use glide to download an image into a bitmap using Kotlin?
- How to use floating image in HTML page?
- How to use a custom png image marker in a plot (Matplotlib)?

Advertisements