# Alt-text for images using @Html.ImageFor()

**URL:** <https://forum.litium.com/t/alt-text-for-images-using-html-imagefor/1741>\
**Category:** Questions\
**Tags:** litium-7\
**Created:** [November 5, 2020, 9:33am UTC](https://forum.litium.com/t/alt-text-for-images-using-html-imagefor/1741 "2020-11-05T09:33:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon.Halling](https://avatars.discourse-cdn.com/v4/letter/s/7c8e57/32.png) [@Simon.Halling](https://forum.litium.com/u/Simon.Halling)\
**Post date:** [November 5, 2020, 9:33am UTC](https://forum.litium.com/t/alt-text-for-images-using-html-imagefor/1741/1 "2020-11-05T09:33:11Z")

</div>

Hi!  
When using the @Html.ImageFor(), how do I get the Alt/Title-text from the image?  
Possible to get the metadata AlternateText that’s set on the image in the MediaArchive?

Thanks 🙂

Litium version: 7.4.2

// Simon

---

<div class="post-metadata">

**Author:** ![steve.redstorm](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/steve.redstorm/32/14_2.png) [@steve.redstorm](https://forum.litium.com/u/steve.redstorm)\
**Post date:** [November 5, 2020, 9:50am UTC](https://forum.litium.com/t/alt-text-for-images-using-html-imagefor/1741/2 "2020-11-05T09:50:33Z")

</div>

Check this query:

> [@Alt text is not mapped](https://forum.litium.com/t/alt-text-is-not-mapped/1441):
>
> I have a ImageProperty in a pagetype. And it looks like this in the CMS But the ALT text is not mapped to the image model by the automapper. [image] [image] Why is the alt text not mapped? Something im missing? Litium version: 6.2.3

---

<div class="post-metadata">

**Author:** ![NilsN](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/nilsn/32/302_2.png) [@NilsN](https://forum.litium.com/u/NilsN)\
**Post date:** [November 9, 2020, 1:11pm UTC](https://forum.litium.com/t/alt-text-for-images-using-html-imagefor/1741/3 "2020-11-09T13:11:45Z")

</div>

The text needs to be set on the `ImageModel` passed to `Html.ImageFor(...)`, it has a property for it. You’d need to set it as a part of building the view model.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [December 7, 2020, 1:11pm UTC](https://forum.litium.com/t/alt-text-for-images-using-html-imagefor/1741/4 "2020-12-07T13:11:49Z")

</div>

Closed on December 7, 2020, 1:11pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
