Limiting width of <select> box

M

Manny Klystron

How do I peg the width of the box generated by a <select> tag, clipping
<options> that're too long for it? It's turning out to be difficult to
google for.


This is IE6, IE7, Safari. IE7 is ignoring the "clip: rect{}" style.
Options are generated in code, so I could do a measure there and clip
by hand, but I wouldn't think I'd need to.


Thanks!
 
T

Toby Inkster

Manny said:
How do I peg the width of the box generated by a <select> tag, clipping
<options> that're too long for it?

Errr... <SELECT style="width:120px;">
 
J

Jukka K. Korpela

Scripsit Toby Inkster:
Errr... <SELECT style="width:120px;">

That might, of course, actually "work" and possibly truncate the options to,
say, two or three characters. Depending on the font size, which _can_ be
enforced by the user.

Instead of creating such problems, the OP should analyze and perhaps
describe us the original problem and the reasons he though that limiting the
width of <select> would solve it. If it's the usual "problem", namely an
attempt to maintain a rigid pixel-dimensioned layout and make a form very
small, then the real solution is to stop creating such problems.
 
M

Manny Klystron

Thanks folks, I stupidly assumed <SELECT width="120px"> would do the
same, but IE7 does honor it in a style. Unfortunately it doesn't honor
style="text-overflow:ellipsis", so the <option>s just get truncated.

And yes, this is for a fixed-width widget. I didn't design it, and
it's for a small captive audience.
 
J

Jonathan N. Little

Manny Klystron wrote:

Please don't top post
Thanks folks, I stupidly assumed <SELECT width="120px"> would do the
same, but IE7 does honor it in a style. Unfortunately it doesn't honor
style="text-overflow:ellipsis", so the <option>s just get truncated.

Never heard of CSS property text-overflow. Googled, ah yes that makes
sense now it is some MS invention...
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top