Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Break huge URLs so they don't overflow

Is there a way to force huge urls such as http://www.google.de/search?q=65daysofstatic&hl=de&safe=off&prmd=ivnsl&source=lnms&tbm=isch&ei=P9NkToCRMorHsgaunaClCg&sa=X&oi=mode_link&ct=mode&cd=2&ved=0CBkQ_AUoAQ&biw=1697&bih=882 break when rendered in the website? I'd rather shorten it but where I'm working they've asked me to show the entire url but I only have a space of 320px to show it and it overflows.

Overflow:hidden, isn't an option either and adding a style to the td where the url is contained is simply ignored.

like image 364
Tsundoku Avatar asked Sep 05 '11 13:09

Tsundoku


People also ask

How do you break a long URL?

The Chicago Manual of Style recommends breaking long URLs (see fig. 1): After a colon or a double slash (//) Before a single slash (/), a tilde (~), a period, a comma, a hyphen, and underline (_), a question mark, a number sign, or a percent symbol.

What is a line break in URL?

The <br> HTML element produces a line break in text (carriage-return).


1 Answers

overflow-wrap to the rescue:

Note: In contrast to word-break, overflow-wrap will only create a break if an entire word cannot be placed on its own line without overflowing.

it has pretty much full browser support and will help when your long word (E.G URLs) cannot fit in the available space

https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap

like image 81
Ryan Avatar answered Oct 16 '22 03:10

Ryan