MyBB Community Forums

Full Version: add a class in the image
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
hello friend.

how to add a class in the image.

I want to add this class:

#ImageContainer { width: 100%; }
img.image { max-width: 100%;}


please help.
Really unsure about the code you posted. However here is the example to add class to an image:

HTML:
<span class="somecls"><img src="http://some.img/image.png" /></span>

CSS:
.somecls { width: 100%; }
.somecls img { max-width: 100%; }
hello effone.

how to add .

I want this code run automatically when adding images.
Bind your image code line with the class in a span (or div) as I've shown in theme template.
Add the css lines in global.css.

If you describe more about where you want to do this we may guide you with more exact code.
I want to put it on showthread and portals
Still not clear. Showthread has many templates (threadlist, thread, newthread etc.)
Do you want it to be applied in user's posts? Then you need to deal with postbit.
in the thread and portals.

what does it matter what newthread same thread. ?

I do not know. I want code that is placed in the post.
Use screenshot. I'm lost Sad
hello effone.

the first in the portal. the picture is too big. I want to use the class so that the image does not get stretched out of the portal.
[attachment=29633]

the second one I wanted to use the classes in the profile album. the picture is too big to lose half. I wish there was added 100% class. http://mods.mybb.com/view/profilealbums

[attachment=29634]

im waiting effone. Lightbulb
1. For portal:

Goto template: "portal_announcement" and find:

<p>
{$message}
</p>

Make it:

<p class="img_ctrl">
{$message}
</p>

2. Now include in your global.css:
.img_ctrl img, .post_body img {
max-width: 100px; 
}

Note: Didn't check, but I guess it will work.
Pages: 1 2