如何将类属性添加到Sitecore MVC图像字段 [英] How to add a class attribute to sitecore MVC image field

查看:58
本文介绍了如何将类属性添加到Sitecore MVC图像字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Sitecore mvc字段渲染

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">

因此,如何在Site core MVC图像字段中添加CSS类.

So, How can I add the css class in Site core MVC image field.

谢谢.

推荐答案

您可以简单地使用它.

@Html.Sitecore().Field("FieldName", Model.PageItem, new { @class="large-image", @mw="250" })

这篇关于如何将类属性添加到Sitecore MVC图像字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆