Code2night
  • Home
  • Guest Posts
  • Tutorial
  • Languages
    • Angular
    • C
    • C#
    • HTML/CSS
    • Java
    • JavaScript
    • Node.js
    • Python
    • React
    • SQL Server
    • TypeScript
  • Post Blog
  • Tools
    • JSON Beautifier
    • HTML Beautifier
    • XML Beautifier
    • CSS Beautifier
    • JS Beautifier
    • PDF Editor
    • Word Counter
    • Base64 Encode/Decode
    • Diff Checker
    • JSON to CSV
    • Password Generator
  • Register
  • Login
  1. Home
  2. Blogpost

Anchor and Image tags in HTML

Date- Dec 09,2023

3422

1.<a> (Anchor Tag):

  • a). The<a> tag is used to create hyperlinks, which allow users to navigate to other web pages or resources by clicking on the linked text or image.
  • b). The primary attribute used with the<a> tag is href (hypertext reference), which specifies the URL of the linked resource.
  • c).You can use the <a> tag to link to other web pages, external websites, local files, email addresses, and more.

Example:-

<a href="https://www.example.com">Visit google.com</a>


In this example, the <a> tag creates a hyperlink that, when clicked, takes the user to the "https://www.google.com" web page.

The<a> tag can also be used with an optionaltarget attribute to control how the linked resource is displayed (e.g., in a new browser window or tab). For example:

<a href="https://www.google.com" target="_blank">Visit google.com in a new tab</a>

2. <img> (Image Tag):

  • a).The<img> tag is used to embed images in web pages. It allows you to display images on a web page by specifying the image file's source (URL).
  • b). The primary attribute for the<img> tag is src (source), which specifies the URL of the image file.
  • c).Additionally, you can use thealt attribute to provide alternative text for the image. This text is displayed if the image cannot be loaded or if a user is using a screen reader.
  • Example:
  • <img src="image.jpg" alt="An example image">
  • In this example, the <img> tag embeds an image from the file "image.jpg" and provides alternative text.

    You can also specify other attributes to control the image's width, height, alignment, borders, and more. For instance:

    <img src="image.jpg" alt="An example image" width="200" height="150" border="1" align="right">

    These attributes control the image's dimensions, border, and alignment.

    Both the <a> and <img> tags are widely used in web development to create hyperlinks and display images, respectively. They are essential for enhancing the interactivity and visual appeal of web pages.



    Result:-










S
Shubham Saini
Programming author at Code2Night — sharing tutorials on ASP.NET, C#, and more.
View all posts →

Comments

Tags

AspNet
C#
programming
AspNet MVC
c programming
AspNet Core
C
software development
tutorial
MVC
memory management
Paypal
coding
coding best practices
data structures
programming tutorial
tutorials
object oriented programming
Slick Slider
StripeNet
Free Download for Youtube Subscribers!

First click on Subscribe Now and then subscribe the channel and come back here.
Then Click on "Verify and Download" button for download link

Subscribe Now | 1760
Download
Support Us....!

Please Subscribe to support us

Thank you for Downloading....!

Please Subscribe to support us

Continue with Downloading
Be a Member
Join Us On Whatsapp Join Us On Facebook
Code2Night

A community platform for sharing programming knowledge, tutorials, and blogs. Learn, write, and grow with developers worldwide.

Panipat, Haryana, India
info@code2night.com
Quick Links
  • Home
  • Blogs
  • Tutorials
  • About Us
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Guest Posts
Free Dev Tools
  • JSON Beautifier
  • HTML Beautifier
  • CSS Beautifier
  • JS Beautifier
  • Password Generator
  • QR Code Generator
  • Hash Generator
  • Diff Checker
  • Base64 Encode/Decode
  • Word Counter
By Language
  • Angular
  • C
  • C#
  • HTML/CSS
  • Java
  • JavaScript
  • Node.js
  • Python
  • React
  • SQL Server
  • TypeScript
© 2026 Code2Night. All Rights Reserved.
Made with for developers  |  Privacy  ·  Terms
Translate Page