Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Feb 8th, 2013  |  syntax: None  |  size: 0.84 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. select {
  2.         border: 1px solid #65A6BA;
  3.         font-size: 11px;
  4.         margin-left: 22px;
  5.         width: 166px;
  6.     }
  7.        
  8. <select>
  9.         <option value="1">Some text</option>
  10.         <option value="2">Text Larger Than the Width of select</option>
  11.         <option value="3">Some text</option>
  12.         <option value="4">Some text</option>
  13.         <option value="5">Some text</option>
  14.     </select>
  15.        
  16. select {
  17.         border: 1px solid #65A6BA;
  18.         font-size: 11px;
  19.         margin-left: 22px;
  20.         width: 166px;
  21.         overflow:visible ;
  22.     }
  23.  
  24. select:focus { width:auto ;
  25. position:relative ;
  26. }​
  27.        
  28. $el = $("select.fixedWidth");
  29. $el.data("origWidth", $el.outerWidth())
  30.  
  31. $el.mouseenter(function(){
  32.     $(this).css("width", "auto");
  33.   })
  34.   .bind("blur change", function(){
  35.     el = $(this);
  36.     el.css("width", el.data("origWidth"));
  37.   });