Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Long string is not splitting on multiple lines in IE

Tags:

css

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.

like image 586
user160820 Avatar asked Jun 22 '10 14:06

user160820


People also ask

How do you break a long string into multiple lines?

Long strings can be written in multiple lines by using two double quotes ( “ “ ) to break the string at any point in the middle.

How do I split text into multiple lines in HTML?

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.

How do I split a string into multiple lines in Linux?

We can use the method splitlines() in string class to achieve this.

How do you split a string into multiple lines in Python?

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.


1 Answers

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.

like image 182
Juan Cortés Avatar answered Sep 23 '22 11:09

Juan Cortés