Left align image caption

HM5 served us well, now its time has come and it has been replaced... If you have HM5 questions, please post them here.

Moderators: Alexander Halser, Tim Green

Post Reply
User avatar
George
Posts: 47
Joined: Thu Sep 22, 2005 3:15 pm
Location: Ice Age

Left align image caption

Unread post by George »

Hi there,

is there a way to left-align the image caption? Whatever I try, it always is centered below the image.

Best regards,
George
User avatar
Alexander Halser
EC-Software Support
Posts: 4098
Joined: Mon Jun 24, 2002 7:24 pm
Location: Salzburg, Austria
Contact:

Re: Left align image caption

Unread post by Alexander Halser »

No sorry. Image captions are always centered below the image.
Alexander Halser
Senior Software Architect, EC Software GmbH
User avatar
George
Posts: 47
Joined: Thu Sep 22, 2005 3:15 pm
Location: Ice Age

Re: Left align image caption

Unread post by George »

Thank you Alexander. I kindly request then that this feature is being considered as an enhancement for the next release.

Best regards,
George
User avatar
George
Posts: 47
Joined: Thu Sep 22, 2005 3:15 pm
Location: Ice Age

Re: Left align image caption

Unread post by George »

Hi Alexander,

can you confirm that this change request has been registered on your side?

As far as I can tell you are embedding the caption into a center-aligned < p > tag. I suggest to offer left/center/right alignment in the image properties dialog.

Best regards
George
Andy121070
Posts: 37
Joined: Wed Feb 03, 2010 11:19 am

Re: Left align image caption

Unread post by Andy121070 »

Can I just ask if anything was done to be able to do this? I would like to be able to set the captions under images to be left aligned.
Regards
Andy
User avatar
Tim Green
Site Admin
Posts: 23153
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Left align image caption

Unread post by Tim Green »

Andy121070 wrote:Can I just ask if anything was done to be able to do this? I would like to be able to set the captions under images to be left aligned.
The built-in image caption is centered and that cannot be changed because the image caption style does not have any editable paragraph attributes. This is for technical reasons, because manually changing the paragraph alignment within the image HTML generated by HM would then require additional changes.

The only way to do this is to not use the integrated image caption. Instead, put the image in a single-cell table with a paragraph beneath it for your caption and then set that paragraph to be left-aligned.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Andy121070
Posts: 37
Joined: Wed Feb 03, 2010 11:19 am

Re: Left align image caption

Unread post by Andy121070 »

Thank you for your response Tim.

When I look at the htm file for one of the compiled topic pages, I see the following line..

Code: Select all

<div><div style="width:596px;padding:0px"><img src="ca_view_zoom80.png" width="596" height="408" style="border:none" alt="Cleaning Area View" title="Cleaning Area View" /><p style="text-align:center"><span class="f_ImageCaption" style="font-size: 10pt;">Cleaning Area View</span></p></div></div>
Looking at this bit specifically

Code: Select all

<p style="text-align:center">
if I change this to text-align:left, I get the result that I am looking for. Is this not the setting that needs to be adjusted to allow for the alignment of the image caption?
Regards
Andy
User avatar
Tim Green
Site Admin
Posts: 23153
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Left align image caption

Unread post by Tim Green »

Hi Andy,

That's correct but it won't help you, because you can't currently make that change from within Help & Manual. You would have to manually edit the HTML every time you publish. :?
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Andy121070
Posts: 37
Joined: Wed Feb 03, 2010 11:19 am

Re: Left align image caption

Unread post by Andy121070 »

Thanks for that, that is kind of what I thought. :cry:
Regards
Andy
User avatar
Martin Wynne
Posts: 2656
Joined: Mon May 12, 2003 3:21 pm
Location: West of the Severn, UK

Re: Left align image caption

Unread post by Martin Wynne »

Andy121070 wrote:Can I just ask if anything was done to be able to do this? I would like to be able to set the captions under images to be left aligned.
Hi Andy,

You can get what you want if you add some scripting to the HTML topic template (in the skin, if you are using one). Immediately above the </body> tag at the bottom of the template insert this:

Code: Select all

<script>
  var img_cap;
  var img_caps_list = document.getElementsByClassName('f_ImageCaption');
  for(img_cap=0; img_cap<img_caps_list.length; img_cap++)
  { img_caps_list[img_cap].parentNode.style.textAlign="left"; }
</script>
That's working fine with H&M 6.5.2.3002 and Firefox. I haven't tested anywhere else -- it won't work in IE earlier than IE9.

It relies on the existing code from H&M where the class is on a <span> inside an unclassed (Normal) <p> having an inline text-align style. If Alexander changes that in a future upgrade, the above will stop working and may produce strange results.

Just to repeat -- the change is made in the skin. That catches me out so many times. :(

regards,

Martin.
User avatar
Tim Green
Site Admin
Posts: 23153
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Left align image caption

Unread post by Tim Green »

Hi Martin,
Just to repeat -- the change is made in the skin. That catches me out so many times.
We know, and we'd really like to make this more intuitive but it's a very difficult thing to do. The optimum would be to grey out all relevant sections in the project if a skin is activated. That's not possible though, because you can use different skins, or no skins, for different builds of the same project. The only real option is to no longer have these sections in the project at all -- i.e. everything only in a skin, with a default skin serving for the current integrated stuff. That's a major change with it's own stumbling blocks, but we're considering it. 8)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Post Reply