2

I am trying to set width for option content. But its taking the width of option value which is having maximum length. I don't have any control over option value length. If its more option content is going out of its parent div class="col-md-6"

How can I restrict the width of option. So that it won't go out of its parent div.

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

  <div class="container">

        <div class="row">
            <div class="col-md-4">

                <label class="control-label">Select Accomplishment</label>

                <select class="form-control form-select">
  <option value="" selected="selected">New Accomplishment</option>
  <option value="0">New AccomplishmentNew AccomplishmentNew AccomplishmentNew AccomplishmentNew AccomplishmentNew AccomplishmentNew AccomplishmentNew AccomplishmentNew AccomplishmentNew Accomplishment</option>
</select>

            </div>

        </div>

    </div>
IamGrooot
  • 940
  • 1
  • 17
  • 44

1 Answers1

0
select {
    width:100%;
}

If you have padding in your class, you may need to reduce it to around 95 or so %.

This works as it applies the select css to the dropdown options too. Just ensure that none of your other classes contradict this.

DKyleo
  • 806
  • 8
  • 11