T.XL T.XL - 2 months ago 8
CSS Question

Is it possible to set the length of a captions max width in the html?

I am working on a task and have used a Jquery plugin to create a lightbox photo gallery. The captions are only allowed to be 600px in length and I am wondering if I can do this in the html, and will it work with the plugin? The caption comes from the alt="" the plug in I have used is photobox master. https://github.com/yairEO/photobox

I have tried putting in

style="width: 600px;"

but may not be placing it correctly. Any advice / guidance is much appreciated. Thank you.

a html sample is below

<li data-keywords="sand dunes beach">
<a href="Photos/08.jpg">
<img src="Photos/Thumbnails/08.jpg" alt="Sand Dunes on the beach, could be anywhere in the world, however it is one of my favourite places. I really enjoyed staying at this location and would recommend it to anyone." title="Sand Dunes" class="photo">
</a>
</li>

Answer

Add the style to photobox' pbCaptionText class:

.pbCaptionText {
  width: 600px;
  /* or alternatively */
  max-width: 600px;
}