I have a large querystring like
http://terra.cic.local/web/index.cfm//pm/uebersicht?sucheAufgeklappt=was%2Cwie%2Cwohin%2Cwann%2Cwer&sucheVon=&sucheBis=&sucheIstErsteSeiteAnzahlProdukteErmitteln=false&sucheIDReiseart=26&sucheHotelart=1081&sucheHotelart=1082&sucheIDLand=347&sucheRegion=214&sucheIstZeitlichFlexibel=true&sucheDauer=&sucheAnzahlErwachsene=2&sucheAnzahlKinder=0&sucheAnzahlPersonen=2&sucheAnzahlSchlafzimmer=&sucheEntfernungStrand=&sucheEntfernungSkilift=
this link will be pasted displayed in a div with 700px width. in FF it will be splitted on multiple line but in IE not.The conplete string is displayed in single line. and break the page layout.
Any suggestion?
Thanks.
Long strings can be written in multiple lines by using two double quotes ( “ “ ) to break the string at any point in the middle.
The word–wrap property is used to split/break long words and wrap them into the next line. The overflow–wrap CSS property is applicable to inline elements & specifies that the browser can break the line inside the selected element into multiple lines in an otherwise unbreakable place.
We can use the method splitlines() in string class to achieve this.
You can have a string split across multiple lines by enclosing it in triple quotes. Alternatively, brackets can also be used to spread a string into different lines. Moreover, backslash works as a line continuation character in Python. You can use it to join text on separate lines and create a multiline string.
Using the following styles:
.divideMe{
width:100px;
word-wrap: break-word;
}
<div class='divideMe'>reallyreallyreallyreallyreallyreallylongstring</div>
It would output
reallyreallyreally
reallyreallyreallyl
ongstring
Though it doesn't really break the word in chunks so you can still select it by double (triple) clicking it. I'm not sure of how browser compatible this is but it seems to work fine on the browsers I have available. Keep in mind that it's a CSS3 property.
Tested on IE 6,7,8 works fine. Also fine on FF 3.6
Another solution would be to hide the overflow and show a scroll bar if you want to keep it in one line. But since your first approach was to show the whole string instead of hiding it, I think this may be a good approach.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With