select dropdown materialize css full width - css

I'm trying to add 2 select dropDown materialize css side by side, in my react app.
But instead they are stacked one on top of each-other and taking up the full width. here is my code.
const SearchPillows = () => {
return (
<div className="container">
<div className="input-field col s12">
<select>
<option value="" disabled selected>Choose your option</option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</select>
<div className="input-field col s12">
<select>
<option value="" disabled selected>Choose your option</option>
<option value="1" className="left">Option 1</option>
<option value="2" className="left">Option 2</option>
<option value="3" className="left">Option 3</option>
</select>
</div>
</div>
<p>hello</p>
</div>
);
};
export default SearchPillows;
Please assist, thanks !!

Several errors in your code:
1) No .row div. .col must live in rows to be responsive.
2) No class name to make the columns side by side, which is .s6, .m6 .l6 etc.
3) Missing closing div tag after the first select.
<div class="container">
<div class="row"><!-- < This was missing -->
<div class="input-field col s12 m6">
<select>
<option value="" disabled selected>Choose your option</option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</select>
</div><!-- < This was missing -->
<div class="input-field col s12 m6">
<select>
<option value="" disabled selected>Choose your option</option>
<option value="1" className="left">Option 1</option>
<option value="2" className="left">Option 2</option>
<option value="3" className="left">Option 3</option>
</select>
</div>
</div>
<p>hello</p>
</div>
</div>
Codepen.

Related

Input-form on select not working | materialize

Anybody knows why the materialize select It’s not working if has the input-field class? I’m using the last materialize version(0.100.2). I’m also adding all the requiered files(css,js,jquery). It works if use the "browser-default" class but not with the "input-field". Any idea of why it’s not working? Help.
It should work like this, but it is not:
<div class="input-field col s12">
<select>
<option value="" disabled selected>Choose your option</option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</select>
<label>Materialize Select</label>
</div>
Only works like this, and looks bad:
<label>Browser Select</label>
<select class="browser-default">
<option value="" disabled selected>Choose your option</option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</select>

Materialize CSS select shows cut off

I have some code using Materialize CSS. I want to show a select with 15 options, but when I select it is cut off. The code in the container is inside a main tag.
$('select').material_select();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/js/materialize.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/css/materialize.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="input-field col s12 m6">
<select>
<option selected="" disabled="" value="">Choose your option</option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
<option value="5">Option 5</option>
</select>
<label>Browser Select</label>
</div>
</div>
</div>

how can i remove extra space in bootstrap

How can I remove the extra space from the first line? I am new to bootstrap can someone help?
Thanks in advance. I want both the lines starting from same point but it's not so.
<form>
<div class="row">
<div class="col-md-7 col-md-offset-1">
<h1>Number of players you want to play with:</h1>
</div>
<div class="col-md-2">
<select name="deals" class="form-control">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
</select>
</div>
</div>
<div clas="row">
<div class="col-md-5 col-md-offset-1">
<h1>Number of point difference</h1>
</div>
<div class="col-md-2"><h1>
<select name="deals" class="form-control">
<option value="1">5</option>
<option value="2">10</option>
<option value="3">15</option>
<option value="4">20</option>
<option value="5">25</option>
<option value="6">30</option>
<option value="7">35</option>
<option value="8">40</option>
<option value="9">45</option>
<option value="10">50</option>
<option value="11">55</option>
<option value="11">60</option>
<option value="11">65</option>
<option value="11">70</option>
<option value="11">75</option>
<option value="11">55</option>
<option value="11">85</option>
<option value="11">90</option>
<option value="11">95</option>
<option value="11">100</option>
</select></h1>
</div><div class="col-md-2"></div>
</div>
<div class="clearfix"></div>
<br><br>
<div class="row">
<div class="text-center">
<div class="form-group">
<input type="submit" class="btn btn-lg btn-primary " value="Deal" >
</div>
</div>
</div>
</form>
</body>
</html>
By default, Bootstrap is adding some top margin to each heading. You will probably have about 20px there, and the select element by default has 0 margin around it.
Either apply a custom css to the select, to move it down to the right place, or create a class that will remove margin top from the headline, then they will match.

How to use Multiple select tag in single line while using bootstrap?

We want to display birthday in dropdown list
How to use Multiple select tag in single line while using bootstrap?
<div class="form-group col-lg-12">
<label>Birthday</label><br>
<select class="form-control" id="sel1">
<option value="jan">Jan</option>
<option value="jan">Feb</option>
<option value="jan">Mar</option>
................
<option value="jan">Dec</option>
</select>
<select class="form-control" id="sel2">
<option value="">Day</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
................
<option value="jan">12</option>
</select>
<select class="form-control" id="sel2">
<option value="">Year</option>
<option value="1992">1992</option>
<option value="1993">1993</option>
<option value="1994">1994</option>
................
<option value="2015">2015</option>
</select>
</div>
Note: we are using bootstrap
You need to use the form-inline class on the parent element...
<div class="form-inline">
<div class="form-group col-lg-12">
<label>Birthday</label><br>
<select class="form-control" id="sel1">
<option value="jan">Jan</option>
<option value="jan">Feb</option>
<option value="jan">Mar</option>
................
<option value="jan">Dec</option>
</select>
<select class="form-control" id="sel2">
<option value="">Day</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
................
<option value="jan">12</option>
</select>
<select class="form-control" id="sel2">
<option value="">Year</option>
<option value="1992">1992</option>
<option value="1993">1993</option>
<option value="1994">1994</option>
................
<option value="2015">2015</option>
</select>
</div>
</div>
DEMO

Restyled select won't line up

For the first time i needed to restyle some dropdown select menu's. Only they leave me with a problem.
I can't seem to get them lined up with the submit image. Anyone got any tips? Maybe i'm overlooking something simple.
<body>
<div class="filterbalk">
<form>
<label>
<select style="width: 250px;">
<option>Woningtype</option>
</select>
</label>
<label>
<select style="width: 250px;">
<option>Plaats</option>
</select>
</label>
<label>
<select style="width: 90px;">
<option value="0">Prijs van</option>
<option value="0">0</option>
<option value="100">100</option>
<option value="200">200</option>
<option value="300">300</option>
<option value="400">400</option>
<option value="500">500</option>
<option value="600">600</option>
<option value="700">700</option>
<option value="800">800</option>
<option value="900">900</option>
<option value="1000">1000</option>
</select>
</label>
<label>
<select style="width: 90px;">
<option value="1000000000">Prijs tot</option>
<option value="100">100</option>
<option value="200">200</option>
<option value="300">300</option>
<option value="400">400</option>
<option value="500">500</option>
<option value="600">600</option>
<option value="700">700</option>
<option value="800">800</option>
<option value="900">900</option>
<option value="1000">1000</option>
<option value="1000000000">1000+</option>
</select>
</label>
<input type="image" src="http://www.wauwwebdesign.nl/problem/buttonFilter.jpg" value="Filter" id="submit">
</form>
</div>
Both HTML and CSS can be found in the fiddle. I can't seem to paste the CSS here.
http://jsfiddle.net/5FcLf/
I think all you need to add is
#submit {
display: inline-block;
vertical-align: top;
}
JSFiddle
Then tweak...

Resources