Here is an example of an HTML element:
<div id="myid_templates_preview_text_1" style="transform: rotate(0deg); border: 1px solid rgb(0, 0, 0); position: absolute; left: 64.5px; top: 144.984px; width: 117px; height: 42px; z-index: 1;">
<p>
<span style="color: #000000; font-size: large;">Sample Very Very Long Line Of Text.</span>
</p>
</div>
Shown below is the output:
https://i.sstatic.net/y4YCK.png
I would like to adjust the text font size so it does not go beyond the borders of the div. How can I achieve this?
UPDATE 1:
I am currently working on a layout designer application and therefore cannot modify the HTML structure provided above. The user dynamically designs the HTML content. Below is another example of HTML structure.
<div id="myid_templates_preview_text_2" style="transform: rotate(0deg); border: 1px solid rgb(0, 0, 0); position: absolute; left: 62px; top: 84px; width: 87px; height: 97px; z-index: 1;">
<p style="text-align: center;">
<span style="font-size: medium;">
<strong>Sample Very Very Long Line Of Text.</strong>
</span>
</p>
<p style="text-align: center;">
<span style="font-size: small;">
<strong>Sample Very Very Long Line Of Text.</strong>
</span>
</p>
</div>