HTML <select> different width when expanded

L

lambertb

Hi,

I'd need this because the image I provided is just for sample. My
select contains fairly large strings, and I don't have enough space on
my page to set the width of my select wide enough to see all text. So I
was wondering if even the select element is somewhat small, it was
possible to at least expand the box to a width so we see all text in
the box that shows all elements when we click on the select.
 
D

Darin McGrew

I'd need this because the image I provided is just for sample. My
select contains fairly large strings, and I don't have enough space on
my page to set the width of my select wide enough to see all text. So I
was wondering if even the select element is somewhat small, it was
possible to at least expand the box to a width so we see all text in
the box that shows all elements when we click on the select.

It sounds to me like a SELECT element isn't the most appropriate choice.
Have you considered radio buttons or checkboxes, which would allow label
text that could wrap to multiple lines as necessary?
 
B

Benjamin Niemann

Hello,


You need a larger monitor. ;)

But the text will be cropped, when the SELECT is not expanded, and the user
has to click on it, in order to read it - not a good idea.
no, really, select is the correct choice, believe me

Unless you provide more context, we have to guess and rely on our
experiences. And this experience tells us that in 99.9% the question is
not "How do I implement XYZ?", but "How do I construct a document so I
don't have to do XYZ?".

To me, this sounds like your layout is much too rigid, and you are suffering
from the consequences of this approach. You can't control how large the
browser window, font size, ... is anyway. If there is enough space to have
the (wide) select and submit button side-by-side, fine. When there is not
enough horizontal space, nobody gets hurt, if the submit button is placed
below the select and the user has to scroll a bit in order to see the
complete document (which is less efford than clicking on the select
control(s) in order to see which option is active).


HTH
 
Joined
Feb 12, 2010
Messages
1
Reaction score
0
IE6 Solution for Full-Length Option Displays

Hi, is this possible to achieve this, and how

This is a bit late, but there are still large groups of people stuck with IE6. Our particular outfit has over 250,000 people - and no I'm not going to yell at our CEO demanding an upgrade.

This solution is sub-optimal in that it hides the drop-down graphic for really long option tags, making the select look more like a textbox. But that doesn't keep the drop-down from working. The instant a user clicks on the field, the full-length dropdown appears. It also requires no javascript and only a tiny bit of CSS. This was developed using IE6. Enjoy!

Code:
<html>  
<head>  
<title>IE6 Hack Full-Length Option Displays</title>  
</head>  
<body>  
  <table >
    <tr>  
      <td><div  style="width: 100px; overflow: hidden; display: inline;">
        <select id=shortselect>  
          <option value="1" title="Test# 1">Test# 11111111111111111111111</option>  
          <option value="2" title="Test# 2">Test# 2222222222222222222222222222222222</option>  
          <option value="3" title="Test# 3">Test# 3333333333333333333</option>  
          <option value="4" title="Test# 4">Test# 4444444444444444444444444</option>  
          <option value="5" title="Test# 5">Test# 555555555555555</option>  
        </select>
        </div>
      </td>
      <td>
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam massa felis, posuere nec, interdum non, fermentum vel, pede. Nam consectetuer massa vitae urna. Morbi sit amet justo. Morbi a tellus. [and other stuff]
      </td>
    </tr>  
    <tr>
      <td colspan="2">
       Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer ligula risus, vehicula sit amet, molestie id, ullamcorper non, nisl. Fusce ullamcorper massa nec urna. Duis condimentum. Vivamus et enim at nibh sodales feugiat. In hac habitasse platea dictumst. [and so on]
      </td>
    </tr>
  </table>  
</body>  
</html>
 

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,079
Messages
2,570,574
Members
47,205
Latest member
ElwoodDurh

Latest Threads

Top