简体   繁体   English

Typo3 6.2在内容元素“ image”上添加一个css类

[英]Typo3 6.2 add a css class on a content element “image”

I add an image in the backend as content element. 我在后端添加一个图像作为内容元素。 The type of this content element is "image". 该内容元素的类型是“图像”。 How can I add a css class to this img-tag? 如何将CSS类添加到此img标签?

I want something like this: 我想要这样的东西:

<img class="responsive" src="xyz.jpg"/>

Ho can I add a class on this image tag? 我可以在此图像标签上添加一个类吗?

My approach: 我的方法:

temp.pics =CONTENT
temp.pics {
    table = tt_content
    select {
        selectFields = image
        pidInList.data = 52
        andWhere = colPos=3
    }
    innerWrap = class="responsive" |

}

My approach isn't really ready. 我的方法还没有真正准备好。

If you want to apply the class to all images, you could add this line to your typoscript. 如果要将该类应用于所有图像,则可以将此行添加到键入内容中。

tt_content.image.20.1.params = class="class1"

If you only want the class to be added on certain images,I would recommend to use the layout field of content elements (or the alignement). 如果只希望将类添加到某些图像上,则建议使用内容元素的布局字段(或对齐方式)。 You can then use the if-Statement, a condition or a CASE-object like this: 然后可以使用if-Statement,条件或CASE对象,如下所示:

tt_content.image.20.1.params.cObject = CASE
tt_content.image.20.1.params.cObject {
  key.field = layout
  default = TEXT
  default.value = class="class1"
  1 = TEXT
  1.value = class="class2"
  2 = TEXT
  2.value = class="class3"
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM