Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Limiting width of <select> box

Reply
Thread Tools

Limiting width of <select> box

 
 
Manny Klystron
Guest
Posts: n/a
 
      12-20-2006
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!

 
Reply With Quote
 
 
 
 
Toby Inkster
Guest
Posts: n/a
 
      12-21-2006
Manny Klystron wrote:

> 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;">

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
Reply With Quote
 
 
 
 
Jukka K. Korpela
Guest
Posts: n/a
 
      12-21-2006
Scripsit Toby Inkster:

>> 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;">


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.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 
Reply With Quote
 
Manny Klystron
Guest
Posts: n/a
 
      12-21-2006
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.

On that note, where's a good place to look for implementing spiffy
Google-style widget drag and drop?

Jukka K. Korpela wrote:
> Scripsit Toby Inkster:
>
> >> 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;">

>
> 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.
>
> --
> Jukka K. Korpela ("Yucca")
> http://www.cs.tut.fi/~jkorpela/


 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      12-21-2006
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...


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
Ervin
Guest
Posts: n/a
 
      05-17-2007
http://9c392fef94789aed6d0c8f9f5b5c27ee-t.meuamq.info <a
href="http://9c392fef94789aed6d0c8f9f5b5c27ee-h.meuamq.info">9c392fef94789aed6d0c8f9f5b5c27ee</a>
http://9c392fef94789aed6d0c8f9f5b5c27ee-b1.meuamq.info
9c392fef94789aed6d0c8f9f5b5c27ee
http://9c392fef94789aed6d0c8f9f5b5c27ee-b3.meuamq.info
a2d4645f3be5a34796fb67577d58472d

 
Reply With Quote
 
Nathaniel
Guest
Posts: n/a
 
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
6500: User-Based Rate Limiting AND Total Rate Limiting Patrick Cervicek Cisco 0 08-07-2007 03:07 PM
GridView Control - limiting width and overflow GregG ASP .Net 5 07-11-2007 07:31 AM
Limiting width of <select> box Manny Klystron HTML 1 12-23-2006 01:34 AM
Drop Down List Border Width vs Text Box Border Width Coder ASP .Net 1 06-24-2006 01:27 PM
Textbox width scaling to width of data not width of page? AndrewF ASP .Net 1 10-10-2005 04:38 PM



Advertisments