r/HTML • • Sep 19 '26

What am I doing wrong?

Post image

No matter what numbers I enter, I always get it wrong. I even used smaller numbers for height and larger for width incase they got it mixed up. Their AI is telling me to do everything I am already doing

4 Upvotes

59 comments sorted by

View all comments

Show parent comment

1

u/testingaurora Sep 20 '26

Its not browser specific, its a lamgiage requirement. Yes the tag will display the image without it, html is forgiving but its still required in the spec. Same way you don't close an <img></img> tag but it will still work.

The required alt attribute specifies an alternate text for an image, if the image cannot be displayed c

The alt attribute must be specified for the IMG and AREA elements. It is optional for the INPUT and APPLET elements. c

Just get in the habit of adding alt="", and then work on learning how to write alt text, and when its necessary , when its not (in which case a background-image may be a better choice)