1

I have a p tag which serve as the label for my images.

Currently if the text inside the paragraph is longer than the width of my images, the label will just "expand" and exceed my image width.

Since my images could be very close to each other, the label become overlapped.

I need some way where i can set the width of the p tag according to the image width, and wrap extra text inside the p tag (bring to the next line). Any idea how to achieve this by anyway?? Appreciate any help...

UPDATE with html:

My image is inside a div

  <div id="Large1_1317379107949"class="image" style="position: absolute; top: 550px; left: 351.549987792969px;"><img id="Large1_1317379107949"src="../../Content/ContainerImg/Large1.png"style="width: 140px; height: 191px;" /></div>

And i later append the label using jquery

 <p id="129">Large Cabinet</p>
0

1 Answer 1

1

You can achieve it with the word-wrap property.

CSS

   .break-word {
      word-wrap: break-word;
    }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.