HTML Anchor tag:
What is a link?
A link in simple terms is a connection from one web resource to another. A link has two ends,An anchor and direction. The link starts at the “source” anchor and points to the “destination” anchor, which may be any Web resource such as an image, a video clip, a audio file, a program, an HTML document or an element within an HTML document.
HTML links are defined with the <a> tag i.e the anchor tag.
Syntax of an anchor tag:
<a href="https://learncoding100.blogspot.com">This is a link</a>
In the example mentioned above, "This is a link" is just a plain text but the actual destination link is written after href in double quotes. So, when you click on the text, it routes you to the destination link.
HTML Image tag:
HTML images are defined with the <img> tag. The <img> tag is used to embed an image in
an HTML page. Images are not inserted into a web page but are are linked to web pages. The <img> tag creates a holding space for the referenced image.
Example:
<img src="image.jpg" alt="image.com" width="104" height="142">
The source file (src), alternative text (alt), width, & height are provided as
attributes.
The <img> tag has two required attributes:
1. src - Specifies the path to the image.
2. alt - Specifies an alternate text for the image, if the image for some reason
cannot be displayed. For instance, if the web page is slow to load & if image is not
displayed, the alternatove text will be displayed in place of the image.
Important point to note: Always specify the width and height of an image. If width and
height are not specified, the page might flicker while the image loads.
Happy Learning!
No comments:
Post a Comment
Comments