How do I change the width of a select field, when using Twitter bootstrap? Adding input-xxlarge
CSS classes doesn't seem to work (like it does on other form elements), so the elements in my drop down are currently cut off.
相关问题
- Adding a timeout to a render function in ReactJS
-
Why does the box-shadow property not apply to a
- How to add a “active” class to a carousel first el
- Add animation to jQuery function Interval
- jQuery hover to slide?
This works for me to reduce select tag's width;
You can use any one of these classes;
You can use something like this
http://getbootstrap.com/css/#column-sizing
For me Pawan's css class combined with display: inline-block (so the selects don't stack) works best. And I wrap it in a media-query, so it stays Mobile Friendly:
with bootstrap use class input-md = medium, input-lg = large, for more info see https://getbootstrap.com/docs/3.3/css/#forms-control-sizes
Tested alone,
<select class=input-xxlarge>
sets the content width of the element to 530px. (The total width of the element is slightly smaller than that of<input class=input-xxlarge>
due to different padding. If this a a problem, set the paddings in your own style sheet as desired.)So if it does not work, the effect is prevented by some setting in your own style sheet or maybe in the use other settings for the element.
I did a workaround by creating a new css class in my custom stylesheet as follows:
And then applied this class to all my select elements either manually like:
Or using jQuery: