HTML Links and Images.
HTML Links
Links are used to connect web pages, email addresses, or other resources.
Link Syntax
Examples
- Internal Link:
<a href="about.html">About Us</a>
- External Link:
<a href="https://www.example.com">Visit Example.com</a>
- Email Link:
<a href="mailto:user@example.com">Email Us</a>
- Phone Link:
<a href="tel:+1234567890">Call Us</a>
Link Attributes
href
: Specifies the link URLtitle
: Specifies a tooltip or link titletarget
: Specifies where to open the link (e.g.,_blank
for new tab)
HTML Images
Images are used to add visual content to web pages.
Image Syntax
Examples
- Image:
<img src="image.jpg" alt="An image on the page">
- Image with Link:
<a href="https://www.example.com"><img src="image.jpg" alt="Example.com"></a>
Image Attributes
src
: Specifies the image URLalt
: Specifies alternative text for the imagewidth
andheight
: Specify the image dimensions
Best Practices
- Use descriptive link text and alternative text for images.
- Use the
title
attribute to provide additional link information. - Use the
alt
attribute to provide alternative text for images.
0 Comments