Discussion:
[TYPO3-english] Adding class attribute to an img tag
Pero Peric
2014-09-11 15:20:02 UTC
Permalink
Hi,

I'm trying to add a class="something" to every image. I tried this:

tt_content.image.20.default.addClassesImage >
tt_content.image.20.default.addClassesImage = something

I also tried this:

tt_content.image.20.default.params = class="something"

and this:

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

but nothing works. Looking into css_styled_content docs it says:

addClassesImage - Add the specified classes to the image element

so anybody knows why this doesn't work? Thx!

regards.
Ralf-Rene Schröder
2014-09-11 17:17:03 UTC
Permalink
for me (in 6.2.4) the following works...

with:
tt_content.image.20.addClassesImage = csc-textpic-first something |*|
something |*| csc-textpic-last something
you add the class to the surrounding div !!!

with:
tt_content.image.20.1.params = class="something"
every image tag directly get's the class

BUT: a class for EVERY image makes no sense !!!
--
image[FORMAT] - Ralf-Ren? Schr?der
http://www.image-format.eu ... Wir geben Ihrem Image das richtige Format
Pero Peric
2014-09-11 18:15:41 UTC
Permalink
Post by Ralf-Rene Schröder
for me (in 6.2.4) the following works...
tt_content.image.20.addClassesImage = csc-textpic-first something |*|
something |*| csc-textpic-last something
you add the class to the surrounding div !!!
Ralf, regarding css_styled_content documentation, class should be added
to the surrounding div with addClasses, while for addClassedImage it says:

"addClassesImage - Add the specified classes to the image element"

This sounds to me as class is added to img element but maybe my english
is not too good.
Post by Ralf-Rene Schröder
tt_content.image.20.1.params = class="something"
every image tag directly get's the class
I tried this but it didn't work in 4.7.19, although this worked for me
back before. Strange.
Post by Ralf-Rene Schröder
BUT: a class for EVERY image makes no sense !!!
Responsive design, bootstrap bla bla. I don't know, i'm not into CSS and
designer said yes, put it on every image :-)

Regards.
Ralf-Rene Schröder
2014-09-12 01:59:03 UTC
Permalink
Post by Pero Peric
Post by Ralf-Rene Schröder
for me (in 6.2.4) the following works...
i had testet it in TYPO3 version 6.2.4 (i havn't read the CSC docs)
maybe you or any extension has modified something there (i.e.
imagecycle) ... look in your TSOB and find the right location
Post by Pero Peric
Post by Ralf-Rene Schröder
BUT: a class for EVERY image makes no sense !!!
Responsive design, bootstrap bla bla. I don't know, i'm not into CSS and
designer said yes, put it on every image :-)
without your own class on every image you could assign every image in
content with standard code in CSS

.csc-textpic img {
foo:bar;
}


maybe you have to override higher specifications with:
DIV.csc-textpic DIV.csc-textpic-imagewrap .csc-textpic-image img {
foo:bar;
}
or in extremly conditions with:
DIV.csc-textpic DIV.csc-textpic-imagewrap .csc-textpic-image img {
foo:bar !important;
}
--
image[FORMAT] - Ralf-Ren? Schr?der
http://www.image-format.eu ... Wir geben Ihrem Image das richtige Format
Pero Peric
2014-09-12 08:59:27 UTC
Permalink
Post by Ralf-Rene Schröder
Post by Pero Peric
Post by Ralf-Rene Schröder
for me (in 6.2.4) the following works...
i had testet it in TYPO3 version 6.2.4 (i havn't read the CSC docs)
maybe you or any extension has modified something there (i.e.
imagecycle) ... look in your TSOB and find the right location
Post by Pero Peric
Post by Ralf-Rene Schröder
BUT: a class for EVERY image makes no sense !!!
Responsive design, bootstrap bla bla. I don't know, i'm not into CSS and
designer said yes, put it on every image :-)
without your own class on every image you could assign every image in
content with standard code in CSS
.csc-textpic img {
foo:bar;
}
DIV.csc-textpic DIV.csc-textpic-imagewrap .csc-textpic-image img {
foo:bar;
}
DIV.csc-textpic DIV.csc-textpic-imagewrap .csc-textpic-image img {
foo:bar !important;
}
Thx. Ralph i will look more into it and hopefully make it work.

Regards.
Pero Peric
2014-09-12 09:20:29 UTC
Permalink
Btw. now i tried putting css_styled_content static template as a last
one (before it as was first in my list) and now
tt_content.image.20.1.params = class="something" works. ah. :-)

regards.
Ralf-Rene Schröder
2014-09-12 10:55:06 UTC
Permalink
when CSC as last static template work for you, then one of your
extensions is modyfying something and won't work now as expected...
(i know that i.e. imagecycle is such an extension)

what extensions have you installed ?
--
image[FORMAT] - Ralf-Ren? Schr?der
http://www.image-format.eu ... Wir geben Ihrem Image das richtige Format
Pero Peric
2014-09-12 12:16:23 UTC
Permalink
Post by Ralf-Rene Schröder
when CSC as last static template work for you, then one of your
extensions is modyfying something and won't work now as expected...
(i know that i.e. imagecycle is such an extension)
what extensions have you installed ?
I'm using following static templates:

Images Frames for CSS styled content
News_settings
Drop-Down site map
Slideshow
SmoothGallery
FlexSlider
CSS Styled Content TYPO3 v.4.6

I could remove one by one and find out which one makes problem.

regards.
Ralf-Rene Schröder
2014-09-12 14:32:26 UTC
Permalink
Post by Pero Peric
Images Frames for CSS styled content
Slideshow
i would suggest these testing first...
--
image[FORMAT] - Ralf-Ren? Schr?der
http://www.image-format.eu ... Wir geben Ihrem Image das richtige Format
Loading...