Link to home
Create AccountLog in
Avatar of PapaparaTudu

asked on

Breaking long links

I'm looking for a way to break long links in my page into multiple lines as currently the page gets skewed because of them. It doesn't look like HTML supports this - I tested the <pre> tag but it only seems to affect strings that contain whitespaces. Is there any way to achieve that so that it works in all these browsers: IE, Firefox, Safari, Opera?

Avatar of gamebits
Flag of Canada image

If they are hard coded you could use a service like tinyurl I guess
You could have the link call a javascript function to load the url based on the link ID, or some such thing.
You could also try detecting the length of the url string using ASP.NET and formatting it so it displays something like this:
<a href=""></a>

Open in new window

Avatar of PapaparaTudu


Karai_17: I like your solution most so far. tinyurl is not what I'm looking for. Link id seems like a  complicated idea.

Actually now I have realised that I would need this functionality not only for links, but also for simply long words. I could detect long words with ASP.NET and if they're over a certain length, I could insert a new line after that position.

Any other ideas?
Avatar of Karai_17
Flag of Canada image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account