Need help to apply style to drop down list

H

Hardy Wang

Hi all,
I have a drop down list with some items, and one of the item contains
very long text. I want to limit the width of the drop down itself, but when
I click down arrow to pull down the content, I want to make <option> item
wide enough to show all characters.

<html>
<head>
<style type="text/css">
option.wide
{
width:auto;
}
select
{
width:100px;
}
</style>
</head>
<body>
<form>
<select>
<option>This is red</option>
<option>This is blue</option>
<option>This is green</option>
<option class="wide">This is wide dhf sdlk hsdlh gldh gldek hjldr hldrh
hdrjh gh gdhg jsdghfaskjg fg f gasfkg</option>
</select>
</form>
</body>
</html>

OK, now the problem is, if I apply CSS to <select> object, the width of
<option> object will be limited too. If I remove CSS for <select>, the whole
drop down will be very wide.

Is there a solution?

Thanks!
 
B

Bruce Barker

the browser <select> does not support this. you can write your own select in
javascript using a, span, a hidden field, an image and a flyout menu. look
at any of the javascript combo box's for starting code.

-- bruce (sqlwork.com)
 

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,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top