I am working with CSS tables and required to display URLs in few of the columns. As you would imagine some of the URLs are way too long to be included in a table as a result of which cruel re sizing is performed within the table ( two rowed entries, table floats to the right etc. ). What are the best practices to handle entries in such cases? Doing some like “half of the entry and then…” or “half entry here … a little bit here” would be the right way to go or is there some better way around it?
Depends on the content, you can use white-space:nowrap to prevent wrapping if you want it to blow out the width that you can scroll to.
If it’s just the URL’s that are causing problems then showing the first 20 chars or so should work.
There’s no one right way to handle it, depends on the content and design.
You can make the content break to a new line using word-wrap:break-word which has good support now and will force the unbroken url to wrap. You need to use it on an inner element rather than a table-cell as some browsers are picky.
Or you could use text-overflow:ellipsis which will truncate the url and apply three dots at the end and is supported in modern browsers.
Or you could do the same as above and then let the url expand on hover so its visible.
I had already removed {text-overflow:ellipsis} from .outer3 since it was being applied by .outer2. Didn’t make any difference. Now I’m really curious…!
This is the code that demonstrates the bleedthru on my screen. Restarted FF with addons disabled (Safe Mode); bleedthru still visible. Odd. I would think that .outer3 .url:hover {position:relative} alone should prevent that.
Ah ok I’ve just realised what you were saying and its the ellipses of the next element that shows through. I thought your image was showing an ellipsis in place on the current entry as I didn’t have any other long urls in my example.
It looks as though Firefox is creating a stacking context for the ellipses to make sure its on top of the text so as you suggest adding a higher z-index fixes the problem. Well spotted