View Full Version : How to display an image in HTML?
shashi101
07-16-2018, 10:15 AM
can anyone help me out to resolve this?
coothead
07-16-2018, 11:15 AM
"How to display an image in HTML?"
This link...
<img>: The Image Embed element (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Img)
...should, hopefully, provide a modicum of enlightenment.
...while this link...
HTML elements reference (https://developer.mozilla.org/en-US/docs/Web/HTML/Element)
...will take you a great deal further on the path. :D
coothead
To reflect an image or other element, including text, a transform property and a scale () function with a negative value are used. The options are:
transform: scale (-1, 1) - horizontal reflection;
transform: scale (1, -1) - vertical reflection;
transform: scale (-1, -1) - simultaneous reflection in the horizontal and vertical.
There are also separate scaleX () and scaleY () functions, they are responsible for scaling by the corresponding coordinates.
Although the scale () function is intended to change the scale of an element, a negative value also allows reflection. In Example 1, a normal image is added, and then it is the same, but it is reflected vertically. To do this, a class called mirrorY is added to the <img>.
Example 1. Reflection of a photo
<! DOCTYPE html>
<html>
*<head>
**<meta charset = "utf-8">
**<title> Reflection </ title>
**<style>
***.mirrorY {transform: scale (1, -1); }
**</ style>
*</ head>
*<body>
**<img src = "images / spam.jpg" alt = "Spam">
**<img src = "images / spam.jpg" alt = "Spam" class = "mirrorY">
*</ body>
</ html>
depsh
02-01-2019, 05:39 PM
Yep, you're right. To insert the image in the HTML you need to write in the body of the document such code:
<img src="image.gif" alt="some text" width=32 height=32>
- img stands for "image." It announces to the browser that an image will go here on the page.
- src stands for "source." This again is an attribute, a command inside a command. It's telling the browser where to go to find the image.
- image.gif is the name of the image. Notice it's following the same type of format as your HTML documents. There is a name (image) then a dot and then there is a suffix (gif).
- alt stands for "alternate text". This tells the browser that if it can't find the image, then just display this text. It also tells anyone who can't view your image what the image is about.
- width stands for just that, the width of the image in pixels. It can range from 1 pixel to, well, just about any number, but generally will be less than the width of the web browser.
- height stands for, as you might guess, the height of the image in pixels. Again, the height can be just about anything, but generally will be less than the height of the web browser.
I take many examples and assignments for HTML from spam link, so I can still show how to activate image (turning an image into a link). In order for the image to become clickable or “active”, the following code needs to be written:
<a href="http://www.site.com"><img src="image.gif" alt="Home"></a>
davidlee21
02-02-2019, 10:18 AM
Use the following code to add image using html
<img src="imgage name.jpg" alt="alt tag">
davidlee21
02-22-2019, 09:27 AM
use this.
<img src="image.jpg" alt="alt tag">
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.