问题
Using Sitecore mvc field render
@Html.Sitecore().Field("FieldName", ContentItem)
I would like to add class to image tag like below,
<img src="/images/Sample.jpg" class="hidden-xs">
So, How can I add the css class in Site core MVC image field.
Thanks in advance.
回答1:
You can simply use this one.
@Html.Sitecore().Field("FieldName", Model.PageItem, new { @class="large-image", @mw="250" })
来源:https://stackoverflow.com/questions/36092433/how-to-add-a-class-attribute-to-sitecore-mvc-image-field