Hi,
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.
Example of all three in a css table:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<style type="text/css">
.outer {
display:table;
width:500px;
border-spacing:20px;
table-layout:fixed;
margin:25px;
border:1px solid red;
}
.cell {
display:table-cell;
border:1px solid #000;
padding:5px;
}
.url{margin:10px 0;padding:2px 4px}
.outer1 .url{word-wrap:break-word}
.outer2 .url{
white-space:nowrap;
text-overflow:ellipsis;
overflow:hidden;
}
.outer3 .url:hover{
overflow:visible;
background:#fcf;
display:table;
position:relative;
padding:0;
border-spacing:0;
border:1px solid red;
}
</style>
</head>
<body>
<div class="outer outer1">
<div class="cell">
<p class="url"><a href="#">alongurlthatpushesthecellwideifnothandledcorrectly</a></p>
</div>
<div class="cell">
<p class="url"><a href="#">along url</a></p>
</div>
<div class="cell">
<p class="url"><a href="#">along url</a></p>
</div>
</div>
<div class="outer outer2">
<div class="cell">
<p class="url"><a href="#">alongurlthatpushesthecellwideifnothandledcorrectly</a></p>
</div>
<div class="cell">
<p class="url"><a href="#">along url</a></p>
</div>
<div class="cell">
<p class="url"><a href="#">along url</a></p>
</div>
</div>
<div class="outer outer2 outer3">
<div class="cell">
<p class="url"><a href="#">alongurlthatpushesthecellwideifnothandledcorrectly</a></p>
</div>
<div class="cell">
<p class="url"><a href="#">along url</a></p>
</div>
<div class="cell">
<p class="url"><a href="#">along url</a></p>
</div>
</div>
</body>
</html>
Bookmarks