HTML Links & Images
HTMLLinks let users navigate between pages. Images make pages visual.
Links
The <a> tag creates a hyperlink. The href attribute specifies the URL.
Images
The <img> tag embeds an image. It has no closing tag. Always include alt text for accessibility.
<!-- Link -->
<a href="https://google.com">Visit Google</a>
<!-- Image -->
<img src="photo.jpg" alt="A beautiful photo"
width="300">
<!-- Link with Image -->
<a href="https://google.com">
<img src="logo.png" alt="Google Logo">
</a>
Interview Questions — HTML Links & Images
5 questions commonly asked in interviews
An HTML link connects one page to another using the <a> tag.
The href attribute specifies the destination URL of a link.
It is used to display images on a webpage.
Alt text describes the image for accessibility and SEO.
It opens the link in a new tab.
Frequently Asked Questions
Common doubts about HTML Links & Images
Yes, using target=\"_blank\".
Not mandatory but highly recommended.
Yes, wrap <img> inside <a>.
Yes using mailto:.
Yes using relative paths.
Test Your Knowledge
5 questions · Earn 50 XP
More on HTML Links & Images
Cheatsheet, tips, resources & what to learn next
Quick Cheatsheet
<a href=\"https://example.com\">Visit</a>
<a href=\"url\" target=\"_blank\">Open</a>
<img src=\"img.jpg\" alt=\"image\">
<a href=\"url\"><img src=\"img.jpg\"></a>
<a href=\"mailto:test@mail.com\">Mail</a>
Pro Tips
Always add alt text.
Use target carefully.
Optimize image size.
Use descriptive link text.
Avoid broken links.