7

I have this HTML Code :

<style type="text/css">
.select {
    white-space:pre-wrap;
    background-color:#FF9;  
        width: 500px;
}
</style>
<input type="text" list="browsers" class="select"/>
<datalist  id=browsers >
    <?php while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)) {;?>
    <option>
        <?php echo $row_Recordset1['RBC']; }?>
    </option>
</datalist>

I have some datas more than 500px , therfore when I click on the text box the list width greater than text box width(500px)

How can i fix the list width?

sermed
  • 105
  • 3
  • 11
  • You probably can't: http://stackoverflow.com/questions/13693482/html5-is-there-a-way-to-apply-a-css-style-on-datalist-options – James Donnelly Mar 28 '13 at 09:15

1 Answers1

0

The only way you can do it is by using CSS with the white-space property and no-wrap.
http://www.w3schools.com/cssref/pr_text_white-space.asp

Or you can use a div around the input to force the size, let the input be the size it needs to be and use the div with overflow-x to control the size and force it to 500px width.

Ryoku
  • 792
  • 1
  • 5
  • 18