I'm using a select box for a page I'm doing. The code for the select box is < select> how can I change the size of the select box in CSS? Can I add an id to it, then change the size of it using CSS?

1 answer

danwellman 5600
0
points
This was chosen as the best answer

Yes, give it an id and then you can target it with CSS, but an id is only required if there is more than one select and you want them both/all to be different sizes. If there is only one select, or multiple select elements that you want to all be the same size just use the select element selector.

Changing the size is easy - #myselect { width:300px; height:100px; }

But, really tall selects look odd if the text inside them is standard size so instead of setting the height it's probably best to increase the font-size and/or padding as the select will grow with the text.

Answered over 7 years ago by danwellman
  • what is the select element selector? is it just S? canyonchase1 over 7 years ago
  • use select { width:etc...} an element selector targets the tag name instead of an id or class name danwellman over 7 years ago