HTML Images - chrisbitm/python GitHub Wiki
In HTML, Images are embedded into Webpages using the <img>
Tag. This Tag requires at least two key attributes:
src (source): Specifies the path or URL to the image file.
alt (alternative text): Describes the content of the image for accessibility and in cases where the image cannot be displayed.
Here’s an example of the syntax:
<img src="sonic.jpg" alt="Sega Mascot Circa 1991" width="500" height="300">
-
src
stands for Source. It specifies the Path or URL of the Image File. -
sonic.jpg
should be replaced with the file path on a local drive or a URL of the Image. -
alt
stands for Alternative Text. It describes the content of the image for Accessibility in case if the image cannot be displayed. -
Sega Mascot Circa 1991
will be the text that shows in a Rectangular Box if you hover over the Image that can't be displayed once the Document is loaded. -
width
specifies the width of the Image. -
height
specifies the height of the Image.
When you are embedding an Image onto your Website. Assuming that you want to keep the original aspect of the ratio, you can specify the dimensions for either height
or width
and instead of a number you can use auto
instead.
<img src="sonic.jpg" alt="Sega Mascot Circa 1991" width="auto" height="300">
<img src="sonic.jpg" alt="Sega Mascot Circa 1991" width="500" height="auto">