Log in

View Full Version : setting the max-width for a div w/o scrollbars.



since
05-24-2010, 12:44 PM
Is it possible to set a span/div with a max-width w/o the scrollbars being present.
I would basically like to mimic the "input" html tag with in a html table.
I would like to use the left,right cursor arrows within the span/div.
Any help would be appreciated.
Steve
e.g.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<title>scroll</title>

</head>
<body>
<table border="1">
<thead style="background-color:white">
<tr>
<th>One</th>
<th>Two</th>
</tr>
</thead>
<tbody>
<tr>
<td>Data</td>
<td><div style="max-width:20px">sdffffffffffffffffffffffffffffffffffffffffffffffffffffffff</div></td>
</tr>
</tbody>
</table>
</div></td></tr></table>
</body>
</html>

kobo1d
05-25-2010, 08:59 AM
im not sure if i understood you right... in your example are no scrollbars visible...
the content grows over the border of the div.. (on winxp/chrome)

if you want to enable scrolling you have to add this to the div/span:


overflow:scroll;

since
05-26-2010, 12:44 PM
I know overflow:scroll allows you to scroll. I want to be able to scroll w/o the scrollbars. Basically the same the behavior as input input text field. The input text field allows you to scroll with just using the left,right cursor keys.

I basically want to embed the div/span in a table td element. I want to have a max size for the div/span, much like you have can have a max size for the input text field.
e.g
<input type="text" size="30" />
where 30 is the max size.
convert the following to a div/span.
<span style=".."> </span>

I can probably use a readonly input field but that seems like a hack.

Steve