How to set bootstrap drop down size? - html

I am very new to designing .
My requirement is I want set the col-mg-2 for my select box.
but it's not adujestble Here I attached fiddle link
http://jsfiddle.net/soumyagangamwar/pno7xojh/2/
If I increse the option length the select box size also increaing. I want to fix it as col-mg-2, if drop down option lenght is much then it i=split two lines.
my code is like
<div class="form-group">
<div class="col-md-3">
<select class="form-control" ng-model="sourceColumn"
ng-options="column.label for column in operationColumn">
<option value="">Source Columns</option>
</select>
</div>
Please Help me?

wrap your select box one div with col-*-2
<form class="form-inline" role="form" name="joinGeneralInfo">
<div class="col-xs-2">
<select class="form-control" ng-model="sourceTable"
ng-options="tabelName.label for tabelName in operationData"
ng-change="getOperationColumns(sourceTable)">
<option value=""> Source Tables</option>
</select>
</div>
<div class="col-xs-2">
<select class="form-control" ng-model="sourceColumn"
ng-options="column in operationColumn">
<option value="">Source Columns</option>
</select>
</div>
</form>
http://jsfiddle.net/pno7xojh/4/

Try This:
You can adjust the width CSS
Add and id to your select
<select class="form-control" ng-model="sourceColumn" id="tableID"
ng-options="column.label for column in operationColumn">
Then use CSS to adjust the size:
#tableID
{
width:30%;//You can adjust the width to your required size.
}

Related

Text field looking option inside my select tag

I cannot seem to quite search for the correct term to solve my issue but, I have this weird text field like thing above my select list:
<div class="col-md-4">
<div class="form-group">
<select class="form-control w-100 config_view_type">
<option value="P">Public</option>
<option value="R">Restricted</option>
</select>
</div>
</div>
what's causing it to appear?
I think you have positioned your form using css. Can you elaborate your code a bit more? I just placed your code inside a template and it seems to be working fine.
<!DOCTYPE html>
<html>
<body>
<h1>The select element</h1>
<p>The select element is used to create a drop-down list.</p>
<form action="/action_page.php">
<label for="cars">Choose a car:</label>
<div class="col-md-4">
<div class="form-group">
<select class="form-control w-100 config_view_type">
<option value="P">Public</option>
<option value="R">Restricted</option>
</select>
</div>
</div>
what's causing
<br><br>
<input type="submit" value="Submit">
</form>
<p>Click the "Submit" button and the form-data will be sent to a page on the
server called "action_page.php".</p>
</body>
</html>
Your code Worked fine, maybe the issue with which bootstrap you linked the document with. try the bootstrap link I used
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<div class="col-md-4">
<div class="form-group">
<select class="form-control w-100 config_view_type">
<option value="P">Public</option>
<option value="R">Restricted</option>
</select>
</div>
</div>

Moving elements of a div to the right

I have a simple parent div element containing multiple child div elements. When the page is loaded, these div elements are displayed on the left. I would like to display these items on the right. How can I achieve this?
Currently, my page elements look like this:
If I try style="float:right", I am getting compressed elements:
Here is the html code:
<div class="row">
<div class="col-md-2" style="text-wrap:none; width:11%">
<label>Requests Per Page: </label>
</div>
<div class="col-md-1" style="text-wrap:none">
<select id="RecordsPerPage">
<option value="10">10</option>
<option value="25" selected="selected">25</option>
<option value="50">50</option>
<option value="100">100</option>
<option value="150">150</option>
<option value="200">200</option>
<option value="250">250</option>
</select>
</div>
<div class="col-md-3" style="text-wrap:none">
Go to Page #:
<input type="number" id="UserPageNumber" min="1" size="5" style="width:50px;" value="1" max="87">
of <span id="spTotalPages">87</span>
<button id="btnPage" onclick="handlePaging();">GO</button>
</div>
</div>
Add class justify-content-end to row element
<div class="row align-items-end">
I also recomend using bootstrap utility classes instead of inline styles. Here is your example - little adjusted: https://www.bootply.com/k7mrP9fHPz
Assumed you are using current version of Boostrap - v4

Display div or input box, when drop down value selected as Others

Plnkr code for review : https://plnkr.co/edit/vWR7kK9MQw4nyciRt1Bj?p=preview
How do I display a div or input box, once a drop down value is selected as Others?
Html
<div class="form-group fields col-sm-2 col-xs-4">
<label>EDUCATION QUALIFICATION *</label>
<select name="education" class="form-control1 drop" required ng-model="model.education" placeholder="select">
<option value='' disabled selected>Select</option>
<option value="male">10th</option>
<option value="female">12th</option>
<option value="male">Graduate</option>
<option value="male">Post Graduate</option>
<option value="male">Ph.d</option>
<option value="other">Others</option>
</select>
</div>
<div class="form-group fields col-sm-2 col-xs-4 floatField" ng-if =" model.education=Others;displayDiv = true">
<label>OTHERS</label>
<input type="text" name="othereducation" class="form-control1" autocomplete="off" ng-model="model.othereducation"/>
</div>
You can use Angular in-built directives ng-show/ng-hide to show or hide the content.
So you can add the below snippet to show the required content when you select the value 'other' in selectbox.
<div ng-show="model.education==='other'">
DIV/input you want to show
</div>
Demo:
JSBin
Here is the working link
Try the code below
Code
<div ng-if="model.education==='other'">
<label >OTHERS</label>
<input type="text" name="othereducation" class="form-control1" autocomplete="off" ng-model="model.othereducation"/>
</div>

Align rendered option text in a select tag

I have this html:
<div class="form-group">
<label for="catId">Category</label>
<select class="form-control" id="catId" ng-model="intCategory"
ng-options="c.Id as c.Category for c in intCategories">
<option value="">--Select--</option>
</select>
</div>
I am using bootstrap for css and angularjs to render the options. Everything is working except that the option text appears to be aligned to the left. How can I center the option text?
Well seems like if I include a display of inline-block in the parent div tag it then works. Really weird.
Here is the updated html:
<div class="form-group" style="display: inline-block;">
<label for="catId">Category</label>
<select class="form-control" id="catId" ng-model="intCategory"
ng-options="c.Id as c.Category for c in intCategories">
<option class="" value="">--Select--</option>
</select>
</div>
You can try using "text-center" class, like this:
<div class="form-group">
<label for="catId">Category</label>
<select class="form-control text-center" id="catId" ng-model="intCategory" ng-options="c.Id as c.Category for c in intCategories">
<option value="">--Select--</option>
</select>
</div>
or
<option class="text-center" value="">--Select--</option>
It works fine with Bootstrap.

Date with bootsrap in 3 drop downs in form

I have an issue I have a form, where i would like to have a 3 drop downs for day / month / year, but all does drop down are placed big one under another but i would like to have it small and horizontal.
Any idea how to do it?
<div class="form-group">
Date:
<Select ... />
<Select ... />
<Select ... />
</div>
This gives me this:
But i would like to have it smaller and next to each other ...
you have to read bs3 Docs
Individual form controls automatically receive some global styling. All textual <input>, <textarea>, and <select> elements with .form-control are set to width: 100%; by default. Wrap labels and controls in .form-group for optimum spacing.
this would work in your case:
<div class="form-group">
Date:
<div class="col-xs-4"><select /></div>
<div class="col-xs-4"><select /></div>
<div class="col-xs-4"><select /></div>
</div>
You could use form-inline..
<form class="form-inline">
<div class="form-group">
Date:
<select class="form-control"><option>One</option></select>
<select class="form-control"><option>Two</option></select>
<select class="form-control"><option>Three</option></select>
</div>
</form>
http://www.bootply.com/126815