HTML tables: horizontal scrolling in td only when needed
I have a table with the following:
<table cellpadding="2" cellspacing="0" > <tr> <td>Contact: </td> <td width="100px"><div style="overflow-x:scroll; width:100px">email@example.com</div> </td> </tr> </table>
This code shows horizontal scrolling in an email cell.
When the email is short, like firstname.lastname@example.org , it shows scrolling but it is not enabled as it is not needed and when the email is longer, say
allows you to scroll so you can see all email.
This is good, but I need the scrolling not to show at all when the letter is short.
How can i do this?
And it doesn't show scrolling when the letter is short, but when the letter is long, it just doesn't scroll it. I think this is because there are no spaces in the letter .
source to share