How to make Dropsdownlist + text inline under 768px? - html

I'm trying to make my dropdownlists I have created to be on the same line under 768px.
Right now, I'm using the form-inline, but that only works over 768px and not under.
Can any tell me how this can be done? Have tried with a list, but that did not work well.
As you can see in the fiddle, I want some text over each dropdownlist. I know i'm not using an label, cause this makes
My Jsfiddle
<div class="col-xs-12">
<div class="form-inline">
<div class="form-group">
Adult<br />
<select class="dropdown" id="Dropdown-adult">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
</div>
<div class="form-group">
Child (3-15)<br />
<select class="dropdown" id="Dropdown-child">
<option>0</option>
<option>1</option>
<option>2</option>
</select>
</div>
<div class="form-group">
Infant (0-3)<br />
<select class="dropdown" id="Dropdown-infant">
<option>0</option>
<option>1</option>
<option>2</option>
</select>
</div>
<div class="form-group">
Pet<br />
<select class="dropdown" id="Dropdown-pet">
<option>0</option>
<option>1</option>
<option>2</option>
</select>
</div>
</div>
<div class="form-group">
<div class="padding-top15">
<button type="submit" class="bookingbutton">BOOK NOW</button>
</div>
</div>
</div>
Hope someone can tell me what I should look at.
Updated:
I think you guys have misunderstood what I was trying to tell. Right now when viewing the page over 768px the dropdownlists are inline as they should be.
If the webpage goes under 768px, all the dropdownlists going out of the inline, which it should not do. I just want to use 2 lines instead of 5-8
I just want it to look the same as it does over 768px. I have uploaded the image of how it should look like under 768px.

It's because Bootstrap add classes to make a responsive grid. If you want your lists to be always on the same line just add this in you css:
.form-group{
display:inline-block
}
JS Fiddle: https://jsfiddle.net/f8gfa768/1/

If I understood you correctly, you want to achieve under 768px width:
[text] [dropdown] <!-- new line -->
[text] [dropdown] <!-- new line -->
[text] [dropdown] <!-- new line -->
[text] [dropdown] <!-- new line -->
Those br tags are messing up your styles. Why don't you remove them, and add display: block/inline-block styles to select element, depending on the window width, which will replace that br:
select{
display: inline-block;
}
#media (min-width: 768px){
select{
display: block;
}
}
#Dropdown-adult {
height: 30px;
font-size: 15px;
width: 45px;
}
#Dropdown-child {
height: 30px;
font-size: 15px;
width: 80px;
}
#Dropdown-infant {
height: 30px;
font-size: 15px;
width: 80px;
}
#Dropdown-pet {
height: 30px;
font-size: 15px;
width: 45px;
}
#Dropdown-vehicles {
max-width: 100%;
height: 30px;
width: 100%;
font-size: 15px;
}
.bookingbutton {
background-color: #F6861F;
border-style: none;
height: 30px;
width: 110px;
color: white;
font-size: 15px;
text-align: center;
font-weight: bold;
font-family: 'Open Sans', sans-serif;
}
.padding-top15 {
padding-top: 15px;
}
select{
display: inline-block;
}
#media (min-width: 768px){
select{
display: block;
}
}
<div class="col-xs-12">
<div class="form-inline">
<div class="form-group">
Adult
<select class="dropdown" id="Dropdown-adult">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
</div>
<div class="form-group">
Child (3-15)
<select class="dropdown" id="Dropdown-child">
<option>0</option>
<option>1</option>
<option>2</option>
</select>
</div>
<div class="form-group">
Infant (0-3)
<select class="dropdown" id="Dropdown-infant">
<option>0</option>
<option>1</option>
<option>2</option>
</select>
</div>
<div class="form-group">
Pet
<select class="dropdown" id="Dropdown-pet">
<option>0</option>
<option>1</option>
<option>2</option>
</select>
</div>
</div>
<div class="form-group">
<div class="padding-top15">
<button type="submit" class="bookingbutton">BOOK NOW</button>
</div>
</div>
</div>
JSFiddle

Related

How to hide the automatically HTML select element on change orientation in Ipad

I have created the one registration application form. The form is working fine except for Iphone and Ipad when we select the dropdown and close. Change the orientation select element automatically opens.
I also tried the solutions which mention in stack overflow question id: iPad opens html select elements automatically
Please help me anyone and below and I'm sharing the code.
$('.form-control').on("orientationchange", function(e) {
e.preventDefault();
});
.form-input {
margin-bottom: 10px;
font-size: 16px;
font-family: 'SlatePro Bold';
color: #565656;
}
.form-input input {
border: 1px solid #2b5795;
font-family: 'SlatePro Regular';
width: 280px;
}
.enroll-form-input {
margin-bottom: 15px;
}
.enroll-form-input input[type=radio] {
width: 2%;
}
<div class="col-md-5 col-sm-12">
<div class="form-input enroll-form-input">
<label for="state">State</label>
<select class="form-control" id="state" name="state" placeholder="*Illinois" data-parsley-required="true" data-parsley-required-message="*State required">
<option value="" selected disabled>*Illinois</option>
<option value="1">State 1</option>
<option value="">State 2</option>
<option value="">State 3</option>
<option value="">State 4</option>
</select>
<!-- <div class="invalid-feedback invalid-state">
<div class="error-message">
<div class="error-icon"><img src="images/error-icon.png" alt="error-icon" /> </div>
<div class="error-content">*State required/div>
</div>
</div> -->
</div>
</div>
Auto opening of the select element on change of screen orientation in Ipad and iPhone with the below jquery code.
$(window).on("orientationchange", function() {
$('select.form-control').blur();
});

How to make one background mild between two background in Homepage?

So I added Two background in Homepage. One is Blue shade and another is an Image. I want to That Blue shade to see more that image. How can I do it.
HTML:
<div class="banner banner-4 banner-4-bg">
<div class="container">
<div class="row">
<div class="col-12">
<div class="banner-content">
<h1>The Easiest Way to Find Job</h1>
<p>Find Jobs, Employment & Career Opportunities</p>
<div class="banner-search">
<form action="#" class="search-form">
<input type="text" placeholder="Enter Keywords">
<select class="selectpicker" id="search-location">
<option value="" selected>Location</option>
<option value="california">California</option>
<option value="las-vegas">Las Vegas</option>
<option value="new-work">New Work</option>
<option value="carolina">Carolina</option>
<option value="chicago">Chicago</option>
<option value="silicon-vally">Silicon Vally</option>
<option value="washington">Washington DC</option>
<option value="neveda">Neveda</option>
</select>
<button class="button primary-bg"><i class="fas fa-search"></i>Search Job</button>
</form>
<div class="trending-key">
<span>Trending Keywords:</span>
designer
php
ios
Android
Accounting
Management
</div>
</div>
</div>
</div>
</div>
</div>
</div>
MY CSS:
.banner-4-bg {
background: url(../images/bg/banner_home.png) , url(../images/bg/banner-4-bg.jpg) no-repeat center;
background-size: cover;
}
.banner-4 .banner-content {
padding: 290px 0 210px;
text-align: center;
color: #ffffff;
}
What I have now :
And What I want:
Help me out Good people :)
There are different ways to do it:
Modify the image and make the same as displayed in the second one.
Make another div same width and height as image and {position: absolute} such that it overlaps the image then { background-color: 'some gray or black color', opacity: 0.5 } (adjust opacity and background-color accordingly). also, write all the displaying content on the banner in this div.
You can adjust the transparency of an image by using CSS opacity, where opacity is between 0.0 - 1.0 and the lower value, the more transparent, e.g.:
.banner-4-bg {
background: url(../images/bg/banner_home.png) , url(../images/bg/banner-4-bg.jpg) no-repeat center;
background-size: cover;
opacity: 0.5;
}
.banner-4 .banner-content {
padding: 290px 0 210px;
text-align: center;
color: #ffffff;
}
Here you go(view it in full screen mode):
I tried to get the images you shared and used it may the clarity is not clear. You may need to use the texts field as you want. As I mentioned in comments interchange the background:urls that should fix for you.
When using the multiple background images, images will be stacked upon each other and the first is the closest to the view.
.banner-4-bg {
background: url(https://i.postimg.cc/DyJRcGNB/Px3iz.png), url(https://i.postimg.cc/wTL0vQZ8/azHDz.jpg) no-repeat center;
background-size: cover;
}
.banner-4 .banner-content {
padding: 290px 0 210px;
text-align: center;
color: #ffffff;
}
<div class="banner-4-bg">
</div>
<div class="banner banner-4 banner-4-bg">
<div class="container">
<div class="row">
<div class="col-12">
<div class="banner-content">
<h1>The Easiest Way to Find Job</h1>
<p>Find Jobs, Employment & Career Opportunities</p>
<div class="banner-search">
<form action="#" class="search-form">
<input type="text" placeholder="Enter Keywords">
<select class="selectpicker" id="search-location">
<option value="" selected>Location</option>
<option value="california">California</option>
<option value="las-vegas">Las Vegas</option>
<option value="new-work">New Work</option>
<option value="carolina">Carolina</option>
<option value="chicago">Chicago</option>
<option value="silicon-vally">Silicon Vally</option>
<option value="washington">Washington DC</option>
<option value="neveda">Neveda</option>
</select>
<button class="button primary-bg"><i class="fas fa-search"></i>Search Job</button>
</form>
<div class="trending-key">
<span>Trending Keywords:</span>
designer
php
ios
Android
Accounting
Management
</div>
</div>
</div>
</div>
</div>
</div>
</div>

Make a text and select dropdown horizontal

I am trying to make a text like label and select dropdown in the same line.
When I use display: inline for both divs it works. But when I use form-control class in select it breaks. Here is the example
Here is the code
<div class="col-md-2">
<div> <span>test</span></div>
<div>
<select class="form-control" id="sel1">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
</div>
</div>
I want to make it in same line.
Add display: flex for container.
.flex {
/* become a flex container */
/* its children will be flex-items */
display: flex;
/* align items on font's baseline */
align-items: baseline;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="col-md-2 flex">
<div><span>test</span></div>
<div>
<select class="form-control" id="sel1">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
</div>
</div>
You can use flex on the container to make it's decendants become flex-items, align-items: center to center them, and have a margin-right on the label to have a nice spacing between it and the select element.
.input-container {
display: flex;
align-items: center;
}
.input-label {
margin-right: 10px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="col-md-2 input-container">
<label class="input-label">test</label>
<select class="form-control">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
</div>
When you use Bootstrap, always think in a Bootstrap way: I mean use its grid layout philosophy.
So you can wrap those 2 <div>s within a .row, and then use the predefined columns you need according to the available breakpoints you want. This procedure should solve your problem:
<div class="row">
<div class="col-your_break_point_unit">
<!-- your text here -->
</div>
<div class="col-your_break_point_unit">
<select>
<!-- your select options here -->
</select>
</div>
</div>
<div class="form-horizontal">
<label>Country</label>
<select>
<option>Nepal</option>
<option>India</option>
<option>China</option>
</select>
Note: form-horizontal class of bootstrap will keep both in the same line.

How to increase width of select box arrow?

I want to increase the width of select box arrow like fa fa caret. i am not getting it how to do. I used img tag inside the each field and given position absolute and adjusted with left top properties but i think this is not proper way of doing this and even i click on the image arrow not select options are opening so i removed this. Please tell me proper solution for it.
.search-categories{
background: #E40444 !important;
color: #fff !important;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-beta1/jquery.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css">
<style type="text/css">
</style>
<div class="col-md-12 ">
<div class="row">
<form action="#" method="get" id="search_mini_form">
<div class="col-sm-offset-2 col-sm-2 catnames">
<select name="cat" class="form-control search-categories">
<option>Categories</option>
<option value="3">abcd</option>
<option value="4">abcd</option>
<option value="5">abcd</option>
</select>
</div>
<div class="col-sm-2 catnames catnames-arrow ">
<select name="cat" class="form-control search-categories search-Hourly">
<option>Hourly</option>
<option value="3">abcd</option>
<option value="4">abcd</option>
<option value="5">abcd</option>
</select>
</div>
<div class="col-sm-4 catquery ">
<div class="input-group">
<input type="search" class="form-control " name="q" id="location" value="" maxlength="128" placeholder="Search Place..." autocomplete="off" />
<div class="input-group-addon catsubmit"><i class="fa fa-search"></i></div>
</div>
</div>
<div id="search_autocomplete" class="search-autocomplete"></div>
</form>
</div>
</div>
You can use the css triangle to make the arrow.
HTML
<div class="selectwrap">
<select>
<option>Option 1</option>
<option>Option 3</option>
<option>Option 4</option>
</select>
</div>
CSS
select {
border: 1px solid #ccc;
height: 34px;
width: 250px;
padding: 6px 12px;
line-height: 1.42857143;
}
.selectwrap {
position: relative;
float: left;
}
.selectwrap:after {
content: "";
position: absolute;
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-top: 8px solid #000;
right: 4px;
top: 14px;
pointer-events: none;
}
It's very complicated to style form elements cross-browser because very browser has different look for form elements (especially checkbox, radio, select, progress).
I suggest using some plugin like select2 so you can easily style very element browser-independent.
$(document).ready(function() {
$('select').select2({
width: '200px'
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="http://select2.github.io/select2/select2-3.5.3/select2.css" rel="stylesheet" />
<script src="http://select2.github.io/select2/select2-3.5.3/select2.js"></script>
<select>
<option>Op 1</option>
<option>Op 2</option>
<option>Op 3</option>
<option>Op 4</option>
</select>
better use some select element customisation plugin like select2, selectize. The appearance that these plugins create can be customised through css.
You cannot fully control the appearance of select element in cross browser manner with css alone.

Bootstrap 3: how to create an inline form with selects and labels?

My labels keep appearing above the selects. I want them all on the same line. Pls see the jsfiddle: http://jsfiddle.net/jjgelinas77/9nL9x/
<div class="well well-sm">
<form name="myForm" role="form" novalidate="novalidate" class="form-inline">
<div class="form-group">
<label>C-Band</label>
<select id="cband" class="form-control">
<option value="C15+">C15+</option>
<option value="C12-14">C12-14</option>
<option value="Other">Other</option>
</select>
</div>
<div class="form-group">
<label>C-Band</label>
<select ng-model="form.cband2" id="cband2" class="form-control">
<option value="C15+">C15+</option>
<option value="C12-14">C12-14</option>
<option value="Other">Other</option>
</select>
</div>
<button class="btn btn-primary">Filter</button>
</form>
</div>
There's a CSS rule in bootstrap that sets the width of .form-control to 100% on small screen sizes. So even when it's floated, it will take the whole width and therefore start on a new line. Good news is you only need a couple lines of CSS to override it:
.form-control {
width:auto;
display:inline-block;
}
Hope this simplifies the problem for anyone still facing the issue! http://jsfiddle.net/c3m77ah6/2/
You have to wrap your label around the select. Like this:
<div class="form-group">
<label>C-Band
<select id="cband" class="form-control">
<option value="C15+">C15+</option>
<option value="C12-14">C12-14</option>
<option value="Other">Other</option>
</select>
</label>
</div>
And then add the following CSS:
.form-group label {
float: left;
text-align: left;
font-weight: normal;
}
.form-group select {
display: inline-block;
width: auto;
vertical-align: middle;
}
Here is your updated fiddle: Updated Fiddle
form-inline class with form-group will do the job like
<div class="form-group form-inline">
<label for="sel1">My InlineSelect: </label>
<select class="form-control" id="rotit">
<option value="1">Value 1</option>
<option value="2">Value 2</option>
<option value="3">Value 3</option>
</select>
</div>
demo : http://jsfiddle.net/9arahevn/2/
This problem is so recorrent that there is a Github project solving it
https://fk.github.io/select2-bootstrap-css/
Place their CSS file right after the CSS from Select2
<link rel="stylesheet" href="css/select2.min.css">
<link rel="stylesheet" href="css/select2-bootstrap.css">
Then you can use the label along with the select
<div class="form-group">
<label for="sName">Select Title</label>
<select class="js-example-basic-single form-control" id="sName">
</select>
</div>
It does work if you use the latest bootstrap:
#import url('http://netdna.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css');
And please DON'T FORGET to make the column with result more than 768px. Form-inline works only if screen with more than 768px. (Just drag the column with a mouse a bit)
The issue was with css for
#media (min-width: 768px)
.form-inline .form-control {
//old bootstrap
display: inline-block;
// new bootstrap
display: inline-block;
width: auto;
vertical-align: middle;
}