# \<img\> tag variations?

**URL:** <https://forum.code.org/t/img-tag-variations/37217>\
**Category:** CS Discoveries\
**Tags:** html-tags\
**Created:** [November 10, 2022, 3:33pm UTC](https://forum.code.org/t/img-tag-variations/37217 "2022-11-10T15:33:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwilson25](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/jwilson25/32/8000_2.png) [@jwilson25](https://forum.code.org/u/jwilson25)\
**Post date:** [November 10, 2022, 3:33pm UTC](https://forum.code.org/t/img-tag-variations/37217/1 "2022-11-10T15:33:46Z")

</div>

I have found the [Wordpress Openverse](https://wordpress.org/openverse/) to be a good place to find photos because it provides students with HTML code they can use to create attributions/licensing info for their pictures. However, the HTML code they provide includes ![]() tags that end with the tag that we are not using in WebLab. I am guessing this is obsolete HTML. Is that correct? Removing the tags makes the code work just fine.

---

<div class="post-metadata">

**Author:** ![mwood](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/mwood/32/4941_2.png) [@mwood](https://forum.code.org/u/mwood)\
**Post date:** [November 10, 2022, 4:31pm UTC](https://forum.code.org/t/img-tag-variations/37217/2 "2022-11-10T16:31:15Z")

</div>

@jwilson25 ,

If you’re referring to the html they give you for crediting the source, it’s not obsolete. They’re just using a lot of formatting and styling to keep it consistent in whatever page you add it to. It seems a bit overkill to me, but it’s legitimate code.

Mike

---

<div class="post-metadata">

**Author:** ![jwilson25](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/jwilson25/32/8000_2.png) [@jwilson25](https://forum.code.org/u/jwilson25)\
**Post date:** [November 11, 2022, 10:54pm UTC](https://forum.code.org/t/img-tag-variations/37217/3 "2022-11-11T22:54:57Z")

</div>

Thanks, Mike. The code works, but it includes tags that WebLab colors RED. Removing these tags removes the WebLab errors and the code still works.

Looking at W3Schools, the tag is not described there. It seems that at the least is an optional tag. Perhaps it is from an earlier version of HTML?

![Outlook-lgsqaqux.gif](https://us1.discourse-cdn.com/flex016/uploads/codeorgforum/original/2X/a/a7b3f93da40e51f29569fee2ba82b04fa0b16b5e.gif)

---

<div class="post-metadata">

**Author:** ![mwood](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/mwood/32/4941_2.png) [@mwood](https://forum.code.org/u/mwood)\
**Post date:** [November 11, 2022, 11:44pm UTC](https://forum.code.org/t/img-tag-variations/37217/4 "2022-11-11T23:44:25Z")

</div>

If you could share a link with me, I’d be happy to look at it and let you know for sure. The links I saw when I visited the site didn’t look out of order, but I’m happy to take a look if you send me an example either on the page or just a copied and pasted sample of the html code you found that is turning red in web lab.

Good luck!

Mike

---

<div class="post-metadata">

**Author:** ![jwilson25](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/jwilson25/32/8000_2.png) [@jwilson25](https://forum.code.org/u/jwilson25)\
**Post date:** [November 12, 2022, 1:18am UTC](https://forum.code.org/t/img-tag-variations/37217/5 "2022-11-12T01:18:04Z")

</div>

Here is some HTML code from a [photo found on openverse](https://wordpress.org/openverse/image/6bb69b0a-6b5a-4a56-9a7e-1881fc48611e). I agree that it is more than required, but it produces a very nice attribution for students to use, so I have encouraged its use. To avoid the complication of removing the offending tags, I have told students they can use the plain text option instead.

> "[Man walking dog, parrot](https://www.flickr.com/photos/39741696@N05/5100437445)" by [Kevins' Collections](https://www.flickr.com/photos/39741696@N05) is licensed under [CC BY-NC-SA 2.0 ![](https://mirrors.creativecommons.org/presskit/icons/cc.svg) ![](https://mirrors.creativecommons.org/presskit/icons/by.svg) ![](https://mirrors.creativecommons.org/presskit/icons/nc.svg) ![](https://mirrors.creativecommons.org/presskit/icons/sa.svg)](https://creativecommons.org/licenses/by-nc-sa/2.0/?ref=openverse).

Thanks for your input on this, Mike.

![Outlook-lgsqaqux.gif](https://us1.discourse-cdn.com/flex016/uploads/codeorgforum/original/2X/a/a7b3f93da40e51f29569fee2ba82b04fa0b16b5e.gif)

---

<div class="post-metadata">

**Author:** ![mwood](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/mwood/32/4941_2.png) [@mwood](https://forum.code.org/u/mwood)\
**Post date:** [November 12, 2022, 6:01am UTC](https://forum.code.org/t/img-tag-variations/37217/6 "2022-11-12T06:01:39Z")

</div>

@jwilson25,

I see what you are saying now. They include the closing img tags: `</img>`.

You are correct. They are not standard html5. They are still required in xhtml which is a more strict version of html, but I’m honestly not even sure why someone would choose to use xhtml instead of html. There’s probably a reason.

The browser will accept them, but since Web Lab is a training tool, it rejects them and colors them pink because they are not used in html5.

So, keep them or delete them. Either way is fine. I would tell my students to delete them just to get in the habit of using the more commonly accepted and widely used version of html (html5).

Mike

---

<div class="post-metadata">

**Author:** ![jwilson25](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/jwilson25/32/8000_2.png) [@jwilson25](https://forum.code.org/u/jwilson25)\
**Post date:** [November 12, 2022, 11:16pm UTC](https://forum.code.org/t/img-tag-variations/37217/7 "2022-11-12T23:16:01Z")

</div>

Thanks, Mike!

[Here’s some info I found on why one might use XHTML.](https://www.w3docs.com/learn-html/xhtml-extensible-hypertext-markup-language.html#:~:text=Benefits%20of%20XHTML%201%20The%20fact%20that%20in,works%20with%20CSS%20to%20create%20web%20pages%20easily.)

[However, it does not appear that the `</img>` tag is part of XHTML.](https://www.devguru.com/content/technologies/xhtml/tags-img.html) I’m still not sure where the `</img>` tag comes from, but it’s clear it is not necessary.

John

---

<div class="post-metadata">

**Author:** ![mwood](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/mwood/32/4941_2.png) [@mwood](https://forum.code.org/u/mwood)\
**Post date:** [November 13, 2022, 3:00pm UTC](https://forum.code.org/t/img-tag-variations/37217/8 "2022-11-13T15:00:19Z")

</div>

You’re right. I can’t find any version of HTML that uses a closing `</img>` tag and even XHTML and HTML 4.01 just use a closing slash at the end of the `<img>` tag itself.

I guess it will have to be a mystery as to why they include it in their citations.

Mike
