Q1. What is the <img> tag used for?
The <img> tag is used to embed images in an HTML page. It is an empty tag that requires src and alt attributes.
Q2. What are the required attributes of the <img> tag?
src (source URL of the image) and alt (alternative text for accessibility and when image fails to load) are required.
Q3. Why is the alt attribute important?
alt text improves accessibility for screen readers, helps SEO, and displays when images fail to load.
Q4. How can you make an image responsive?
Use CSS: max-width: 100% and height: auto ensures images scale properly on different screen sizes.
Q5. What image formats are commonly used in HTML?
Common formats: JPEG (photos), PNG (transparency), GIF (animations), SVG (scalable graphics), WebP (modern compression).
