Text wrapping with table-layout: fixed

R

Ryan Stewart

The code below does almost exactly what I want it to. The only thing
that's wrong is that the text needs to wrap if it overflows
horizontally. By using "overflow-x: auto" in the div, you can put a
scrollbar in that will properly display everything, but that isn't
acceptable. Also, you can achieve the desired wrapping effect by
specifying an absolute size rather than relative, but that's no good
either. It needs to be a dymanically sizing table with horizontal text
wrapping and a vertical scrollbar when needed. Ignore everthing within
the <ul> tags. This is just a prototype and I needed some filler to
test it.

<html>
<head>
<title>A Prototype</title>
<link rel="stylesheet" type="text/css" href="myStyle.css" />
</head>

<body>
<div align="center">
<table style="width: 100%; height: 100%; table-layout: fixed;"
class="outer">
<tr style="height: 1%;">
<td align="left" valign="top" class="header">
Aircraft
</td>
</tr>
<tr>
<td align="left" valign="top" style="width: 100%;">
<div style="height: 100%; width: 100%; overflow-y: auto;">
<ul>
<li><a href="catView.html"><img src="redSquare.gif"
border="0" />&nbsp;Category 1</a></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A
Category</li>
<li><a href="" onclick="window.open('test.doc');return
false;"><img src="greenCircle.gif" border="0" />&nbsp;A File</a></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A
very very very very very long file description that couldn't possibly
fit in one table width. <a href="fileView.html"
class="desc">More</a></li>
<li><a href="" onclick="window.open('test.doc');return
false;"><img src="greenCircle.gif" border="0" />&nbsp;A File</a></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A
file description. <a href="fileView.html" class="desc">More</a></li>
<li><a href="" onclick="window.open('test.doc');return
false;"><img src="greenCircle.gif" border="0" />&nbsp;A File</a></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A
file description. <a href="fileView.html" class="desc">More</a></li>
<li><a href="" onclick="window.open('test.doc');return
false;"><img src="greenCircle.gif" border="0" />&nbsp;A File</a></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A
file description. <a href="fileView.html" class="desc">More</a></li>
</ul>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>
 
R

Robert Frost-Bridges

Ryan said:
The code below does almost exactly what I want it to. The only thing
that's wrong is that the text needs to wrap if it overflows
horizontally.

[snip code & stuff]

Changing the div width to, for instance, 50%, wraps the text.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,001
Messages
2,570,254
Members
46,850
Latest member
VMRKlaus8

Latest Threads

Top