How to deploy a simple word for Opera browser

I am currently testing this feature in all browsers using php.

<style> #preview_desc{ text-wrap: suppress; word-break: break-all; word-wrap: break-word; /* IE>=5.5 */ white-space: -moz-pre-wrap; /* For Fx<=2 */ white-space: pre-wrap; /* Fx>3, Opera>8, Safari>3 */ white-space: -o-pre-wrap; /* Opera 7 */ white-space: pre-line; width:158px; padding-left:5px; padding-right:5px; line-height:12px; font-family:'Arial', Helvetica, sans-serif; font-size:11px; text-align:justify; background:#f30000; } </style> <div id="preview_desc" class="adlookmsg_box"> Refeforotherapplicationandcontainasdhlsakfhnaiufalsdufgnaloskdufglkjblfasug </div> 

However, only in the Opera browser, which does not handle wrapping or a non-spatial word. Please if someone can help with this. Tks

- Edited-- note: sorry for this question.

+3
source share
1 answer

I also use Opera 10.10, I can regenerate your problem, but, unfortunately, I do not have a good / correct answer, but hack here. Do this if there is no other way . Put the following codes at the end of the document.

 <script> x=document.getElementById("preview_desc"); x.innerHTML=x.innerHTML.replace(/(.)/g,"$1\u200b"); </script> 

It will put a β€œZero Width” character after each character, so Opera will be able to handle this.

UPDATE : add only the long words currently set as 10+, you may need to edit it.

 <script> x=document.getElementById("preview_desc"); x.innerHTML=x.innerHTML.replace(/[\w]{10,}/g,function(x){return x.replace(/(.)/g,"$1\u200b");}); </script> 
+3
source

All Articles