1

I have a ddl in my menu and wish to center the text. Because the ddl selected values are different lengths, they go off center. Any help appreciated.

I've tried text-indent as in the example below.

select {
  font-weight: bold;
  color:#fff;
  background:#444444;
  border:0;
  text-indent: 20%;
  font-size:18px;
  height:29px;
}
<select>
  <option value="0">Mixed Job Lot</option>
  <option value="1">Antiques / Art</option>
  <option value="2">Baby &amp; Toddler Stuff</option>
</select>
Paulie_D
  • 107,962
  • 13
  • 142
  • 161
Eggybread
  • 161
  • 1
  • 12
  • Not really an asp.net question. You could create this as normal html/css in a [snippet](https://stackoverflow.blog/2014/09/16/introducing-runnable-javascript-css-and-html-code-snippets/) to demonstrate exactly what you mean – freefaller Jun 07 '19 at 09:27

1 Answers1

2

Simply add text-align-last:center; to your select option

select {
  font-weight: bold;
  color:#fff;
  background:#444444;
  border:0;
  font-size:18px;
  height:29px;
  text-align-last:center;
}
<select>
  <option value="0">Mixed Job Lot</option>
  <option value="1">Antiques / Art</option>
  <option value="2">Baby &amp; Toddler Stuff</option>
</select>
Nisharg Shah
  • 16,638
  • 10
  • 62
  • 73