Select box `appearance` on Mac /safari or chrome - html

How can I make the select box look the same on all web browsers and devices but I can't find the right way to do that, so far the biggest problem is on IE 10 and Microsoft edge, it seems the appearance is not working!
can anyone help with this issue? thank you.
.form {
width: 300px;
padding: 20px;
background-color: #f5f5f5;
}
.textfield,
.select {
margin-top: 5px;
padding: 5px;
width: 100%;
}
.select {
background: #fff;
border-radius: 0;
}
<div class="form">
<div>
<label for="text">
<nobr>Text field</nobr>
</label>
<br />
<input name="text" tabindex="1" class="textfield" />
</div>
<br />
<div>
<br />
<select name="select" tabindex="2" class="select">
<option value="">-- Please Select --</option>
<option value="option 1">Option 1</option>
<option value="option 2">Option 2</option>
</select>
</div>
</div>

To make the textbox and select box have exactly the same appearance style-wise, pick the style you want (i.e. something like border: 1px solid #666666 to mimic the <input> element) and apply it to both your .textfield and .select classes together.
You can use JavaScript to only apply that style when the user is on a Mac, if you want. (See this answer.)
.form {
width: 300px;
padding: 20px;
background-color: #f5f5f5;
}
.textfield,
.select {
margin-top: 5px;
padding: 5px;
width: 100%;
border: 1px solid #666666;
}
.select {
background: #fff;
border-radius: 0;
}
.asterisk {
color: #FF0004;
}
<div class="form">
<div>
<label for="text">
<nobr>Text field</nobr>
</label>
<br />
<input name="text" tabindex="1" class="textfield" />
</div>
<br />
<div>
<label for="select">
<nobr>Select<span class="asterisk">*</span></nobr>
</label>
<br />
<select name="select" tabindex="2" class="select">
<option value="">-- Please Select --</option>
<option value="option 1">Option 1</option>
<option value="option 2">Option 2</option>
</select>
</div>
</div>

.form {
width: 300px;
padding: 20px;
background-color: #f5f5f5;
}
.textfield,
.select {
margin-top: 5px;
padding: 5px;
width: 100%;
border: 1px solid #666666;
}
.select {
background: #fff;
border-radius: 0;
}
.asterisk {
color: #FF0004;
}
<div class="form">
<div>
<label for="text">
<nobr>Text field</nobr>
</label>
<br />
<input name="text" tabindex="1" class="textfield" />
</div>
<br />
<div>
<label for="select">
<nobr>Select<span class="asterisk">*</span></nobr>
</label>
<br />
<select name="select" tabindex="2" class="select">
<option value="">-- Please Select --</option>
<option value="option 1">Option 1</option>
<option value="option 2">Option 2</option>
</select>
</div>
</div>

I added an image as a background to the select field, some people recommended it and its working great.
simply add bellow to .select in the css:
background: #fff;
border-radius: 0;
-webkit-appearance: none;
/* **this should be your icon or image to replace the down arrow** */
background :url('http://via.placeholder.com/10x10') 95% no-repeat;
background-color: #fff;
background-position: right;
background-size: 14px;

Related

Need CSS for the below html to create border, sample image attached

I want to have a border size for the below html code but I am unable to do so and have tried with its attribute's. pls if I can have the css for it.
<div class="navbar1">
<div class="select-div">
<select name="country" class="form-control" id="country">
<option value="USA" label="United States">United States</option>
<option value="CN" label="Canada">Canada</option>
</select>
<select name="language" class="form-control" id="language">
<option value="USA" label="English">English</option>
<option value="Mexico" label="Spanish">Spanish</option>
</select>
<select name="search" class="form-control" id="search">
<option value="search" label="Search">Search</option>
</select>
</div>
</div>
I tried writing CSS using the class,label,id attributes but I am unable to design it the way it's in the image attached
If i understand you correctly, you want to make select option like in the image.
if that's the case, Kindly check some changes below - if that helps.
I have added the icon using pseudo element ::after
select{
padding: 5px 30px 5px 5px;
appearance: none;
width: 150px;
border: 1px solid #bebebe;
}
.select,
.select-dark{
position: relative;
}
.select::after {
content: '\25BC';
position: absolute;
top: 5px;
right: 10px;
color: #6BBDD7;
cursor:pointer;
pointer-events:none;
transition:.25s all ease;
}
.select-dark::after {
content: '\25BC';
position: absolute;
top: 0;
right: 0;
background-color: #117CC0;
color: #fff;
cursor: pointer;
pointer-events: none;
transition: .25s all ease;
padding: 6px 6px 3px
}
<div class="select-div" style="display: flex;gap:20px">
<div class="select">
<select name="country" class="form-control" id="country">
<option value="USA" label="United States">United States</option>
<option value="CN" label="Canada">Canada</option>
</select>
</div>
<div class="select">
<select name="language" class="form-control" id="language">
<option value="USA" label="English">English</option>
<option value="Mexico" label="Spanish">Spanish</option>
</select>
</div>
<div class="select-dark">
<select name="search" class="form-control" id="search">
<option value="search" label="Search">Search</option>
</select>
</div>
</div>

Why does my <input> tags not align on the right-hand side of the parent tag?

Right, I am getting so angry right now I could scream.
Why does my <input> tags not align on the right hand side of the parent tag <form-container>, its making me really cross, as I've not had this issue before. I have set the width:100%; to the <select>, <input>, <textarea> relative to the <form-container> tag, which -in turn- is set to 75% of the #center tag however, they are "spewing" over the parent tag, the <select>, <input>, <textarea> tags are not aligned with one another.
There is no reason as to why this is happening, it's absolutely ridiculous, I am experienced coder so if I can't fix it then there's probably a bug with Dreamweaver - which I have reported? Here is my coding
#form-container{
margin: 0 auto;
width:75%!important;
}
input, textarea, select, .select {
height: 40px;
font-size: 14px;
width: 100%;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
cursor: pointer;
font-weight: bold!important;
color: #0d0155!important;
border-radius: 0px!important;
padding-right: 0px;
}
input, select{
padding-left: 5px;
border-radius: 0px!important;
background-color: transparent!important;
}
textarea{
height: 300px;
padding: 10px;
}
.select {
border:1px solid #3A83F3;
overflow: hidden;
width: 100%;
position: relative;
display: block;
}
body{
margin: 0px;
padding: 0px;
width: 100%!important;
}
#center, #inner-center, #breadcrumb{
width: 90%!important;
margin: 0 auto!important;
}
} #center, #inner-center, #breadcrumb{
width: 90%!important;
margin: 0 auto!important;
}
#center{
padding: 10px;
}
<head>
</head>
<body>
<div id="center"><!-- InstanceBeginEditable name="master-template-body" -->
<div id="form-container">
<form action="xxxx" method="POST" enctype="multipart/form-data">
<label class="select">
<select name="title" required>
<option value="" disabled selected>Choose your title</option>
<option>Mr.</option>
<option>Mrs.</option>
<option>Master.</option>
<option>Ms.</option>
<option>Miss</option>
<option>Dr.</option>
<option>Lord</option>
<option>Lady</option>
<option>HRH</option>
<option>Baroness</option>
<option>Esquire</option>
<option>Other</option>
</select>
</label><br/><br/>
<input required name="first" type="text" placeholder="First name"><br/><br/>
<input required name="surname" type="text" placeholder="Surname"><br/><br/>
<label class="select">
<select name="department" required>
<option value="" disabled selected>Choose your department</option>
<option value="Submitting a Story">Submitting a Story</option>
<option value="Press Office">Press Office</option>
<option value="Executive Team">Executive Team</option>
<option value="Invoicing & Accounts Payable">Invoicing & Accounts Payable</option>
<option value="Accounts Recrivable">Accounts Receivable</option>
<option value="Complaints">Complaints</option>
<option value="Legal">Legal</option>
</select>
</label>
<br/><br/>
<input required name="email" type="email" placeholder="Email (ex. name#domain.com)"><br/><br/>
<input required name="number" type="tel" placeholder="Contact Number"><br/><br/>
<textarea required name="userMessage" placeholder="Type your message here. Please do not include sensitive information such as credit card numbers or National Insurance Numbers."></textarea><br/><br/>
<label style="display: none;" for="standard-button" class="standard-button">Send your message</label>
<input class="standard-button" style="padding: auto; height: auto;" type="submit" value="Send your message"/>
</form>
</div>
<!-- InstanceEndEditable -->
<div id="copyright-info">All Rights Reserved. © 2020</div>
</div>
</body>
Add box-sizing: border-box; to your inputs
#form-container{
margin: 0 auto;
width:75%!important;
}
input, textarea, select, .select {
height: 40px;
font-size: 14px;
width: 100%;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
cursor: pointer;
font-weight: bold!important;
color: #0d0155!important;
border-radius: 0px!important;
padding-right: 0px;
box-sizing: border-box; /*here the change*/
}
input, select{
padding-left: 5px;
border-radius: 0px!important;
background-color: transparent!important;
}
textarea{
height: 300px;
padding: 10px;
}
.select {
border:1px solid #3A83F3;
overflow: hidden;
width: 100%;
position: relative;
display: block;
}
body{
margin: 0px;
padding: 0px;
width: 100%!important;
}
#center, #inner-center, #breadcrumb{
width: 90%!important;
margin: 0 auto!important;
}
#center{
padding: 10px;
}
<head>
</head>
<body>
<div id="center"><!-- InstanceBeginEditable name="master-template-body" -->
<div id="form-container">
<form action="xxxx" method="POST" enctype="multipart/form-data">
<label class="select">
<select name="title" required>
<option value="" disabled selected>Choose your title</option>
<option>Mr.</option>
<option>Mrs.</option>
<option>Master.</option>
<option>Ms.</option>
<option>Miss</option>
<option>Dr.</option>
<option>Lord</option>
<option>Lady</option>
<option>HRH</option>
<option>Baroness</option>
<option>Esquire</option>
<option>Other</option>
</select>
</label><br/><br/>
<input required name="first" type="text" placeholder="First name"><br/><br/>
<input required name="surname" type="text" placeholder="Surname"><br/><br/>
<label class="select">
<select name="department" required>
<option value="" disabled selected>Choose your department</option>
<option value="Submitting a Story">Submitting a Story</option>
<option value="Press Office">Press Office</option>
<option value="Executive Team">Executive Team</option>
<option value="Invoicing & Accounts Payable">Invoicing & Accounts Payable</option>
<option value="Accounts Recrivable">Accounts Receivable</option>
<option value="Complaints">Complaints</option>
<option value="Legal">Legal</option>
</select>
</label>
<br/><br/>
<input required name="email" type="email" placeholder="Email (ex. name#domain.com)"><br/><br/>
<input required name="number" type="tel" placeholder="Contact Number"><br/><br/>
<textarea required name="userMessage" placeholder="Type your message here. Please do not include sensitive information such as credit card numbers or National Insurance Numbers."></textarea><br/><br/>
<label style="display: none;" for="standard-button" class="standard-button">Send your message</label>
<input class="standard-button" style="padding: auto; height: auto;" type="submit" value="Send your message"/>
</form>
</div>
<!-- InstanceEndEditable -->
<div id="copyright-info">All Rights Reserved. © 2020</div>
</div>
</body>

How to align left and right in HTML so that part of one element slips under another as the screen narrows?

At the moment two of my columns are as follows. They work fine when the screen width is above 900px.
How can I allow the bottom element in column 3 to slip under the element in column 2 when the screen narrows to about 800px, so as to retain the graphical concept? I am after a solution using pure HTML and CSS, no JS, giving something like this:
#col3 {
float: left;
width: 60px;
}
#col4 {
font-size: 80%;
display: inline;
float: right;
text-align: right;
text-decoration: none;
padding: 0 20px 0 0;
}
.col4-mitem {
text-align: center;
text-decoration: none;
padding-left: 20px;
font-size: 80%;
}
.col4-mitem a:link,
a:visited {
color: #000;
text-decoration: none;
border-bottom: 0;
}
.col4-mitem a:hover,
a:active {
color: #f00;
}
#stext-input {
border: solid 1px;
border-right: none;
font-size: 80%;
float: left;
height: 14px;
padding-left: 5px;
width: 180px;
}
<div id="col3">
<select class="select-box" id="form">
<option value="">Browse past issues</option>
<option value="http://foobar.com/1.html">Issue 7</option>
<option value="http://foobar.com/2.html">Issue 8</option>
<option value="http://foobar.com/3.html">Issue 9</option>
<option value="http://foobar.com/4.html">Issue 10</option>
</select>
</div>
<!--close col3-->
<div id="col4">
<span class="col4-item">link 1</span>
<span class="col4-item">link 2</span>
<br>
<form method="get" id="search" action="http://duckduckgo.com/">
<input type="hidden" name="sites" value="foobar.com" />
<input type="hidden" name="k8" value="#f00" />
<input type="hidden" name="k9" value="#00f" />
<input type="hidden" name="kaa" value="#808" />
<input type="hidden" name="ks" value="m" />
<input type="hidden" name="kt" value="a" />
<input type="hidden" name="ka" value="a" />
<input type="hidden" name="k1" value="-1" />
<input type="text" name="q" id="stext-input" placeholder="Search...">
<input id="yes" type="image" src="yes.png">
</form>
<br>
<div class="strap-line">strap line strap line strap line strap line strap line </div>
</div>
<!--close col4-->

Can't get select2 dropbox to work within a listbox row

I have a listbox container with 3 items displayed on each row.
The first item is a label checkbox, the second is a Select2 dropbox, the third is a link to a popup.
My Fiddle Fiddle shows a single row taken from the listbox.
After several hours I've managed to structure the 3 items on a single row, but the Select2 dropbox shows the dropdown menu instead of the input box.
Any ideas how to get the dropbox working properly? Also, I'm very unsure about the way I've structured the coding for each row. Would be good to know if there's a more efficient / more robust approach. Much appreciate any help.
https://select2.github.io/select2/select2-3.5.1/select2.js
https://select2.github.io/select2/select2-3.5.1/select2.css
<label>
<input type="checkbox" name="checkbox" id="First" />
<span class="LHLabelClass">First row LH label:</span>
</label>
<span class="MiddleLabelClass">
<select id="multipleSelectExample1" class="tester" data-placeholder="Select type" multiple="multiple">
<option value="Option 1">Option 1</option>
<option value="Option 2">Option 2</option>
<option value="Option 3">Option 3</option>
</select>
</span>
<span class="RHLabelClass">
<a href="#" id="POPUP1" >First RH row label</a>
</span>
$(function() {
$("#multipleSelectExample1").select2({});
});
* {
box-sizing: border-box;
}
.LHLabelClass {
color: blue;
margin-left: 10px;
margin-right: 20px;
margin-bottom: 30px;
width: 150px;
display: inline-block;
border: 1px solid blue;
}
.MiddleLabelClass {
width: 100px;
margin-right: 30px;
display: inline-block;
border: 1px solid brown;
}
.RHLabelClass {
width: 150px;
display: inline-block;
border: 1px solid green;
}
.select2-container-multi .select2-choices {
outline:none;
width: 224px!important;
height: 27px!important;
padding: 0px 0px 0px 0px;
border: 1px solid transparent;
}
.select2-container-multi .select2-choices .select2-search-choice{
outline:none;
font-size: 11px;
background:#CEDDF0;
color: black;
padding: 2px 3px 2px 16px!important;
margin-top: 5px!important;
margin-right: 3px;
margin-left: 4px;
border: 1px solid #605D9C;
}
.select2-drop{
outline:none;
font-size: 12px;
color: black;
}
Check the console of your fiddle,You are missing the jquery file here:
$(function() {
$("#multipleSelectExample").select2({});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://select2.github.io/select2/select2-3.5.1/select2.css" rel="stylesheet"/>
<script src="https://select2.github.io/select2/select2-3.5.1/select2.js"></script>
<label>
<input type="checkbox" name="checkbox" id="First" />
<span class="LHLabelClass">First row LH label:</span>
</label>
<span class="MiddleLabelClass">
<select id="multipleSelectExample" class="tester" data-placeholder="Select type" multiple="multiple">
<option value="Option 1">Option 1</option>
<option value="Option 2">Option 2</option>
<option value="Option 3">Option 3</option>
</select>
</span>
<span class="RHLabelClass">
<a href="#" id="POPUP1" >First RH row label</a>
</span>

tab inside input type text

I need to create search form like on the picture but I don't know how to put inside tab with dropdown list. Currently I have such a code
<form action="" class="search-form">
<input type="text" class="form-control empty" id="iconified" placeholder=""/>
</form>
You could do it like this, but you would need to style it the way that you wan't it.
I added a <select> tag and a <input type="submit" value="Search"> button
<form action="" class="search-form">
<input type="text" class="form-control empty" id="iconified" placeholder=""/>
<select name="" id="">
<option value="">Option 1</option>
<option value="">Option 2</option>
<option value="">Option 3</option>
<option value="">Option 4</option>
</select>
<input type="submit" value="Search">
</form>
Just add the images in your styling in sudo elements(:after, :before).
#iconified {
padding: 10px;
width: 56%;
border-radius: 7px;
border: 2px solid #DDDDDD;
outline: none;
}
input[type="submit"] {
position: absolute;
left: 308px;
top: 16px;
}
select {
position: absolute;
left: 225px;
top: 17px;
background: none;
border: 1px solid #DDD;
border-top: 0;
border-bottom: 0;
outline: none;
}
<form action="" class="search-form">
<input type="text" class="form-control empty" id="iconified" placeholder="search"/>
<select name="" id="">
<option value="">Option 1</option>
<option value="">Option 2</option>
<option value="">Option 3</option>
<option value="">Option 4</option>
</select>
<input type="submit" value="Search">
</form>
Try the below sample
::-webkit-input-placeholder {
text-align: left;
padding: 35% 35% 0 15%;
}
:-moz-placeholder { /* Firefox 18- */
text-align: left;
}
::-moz-placeholder { /* Firefox 19+ */
text-align: left;
}
:-ms-input-placeholder {
text-align: center;
}
#iconified {
/*padding: 10px;*/
width: 24%;
border-radius: 7px;
border: 2px solid #DDDDDD;
outline: none;
}
input[type = "text"] {
background: url("http://png.findicons.com/files/icons/1389/g5_system/32/toolbar_find.png") top left no-repeat;
background-size: 10%;
background-position: 4px 8px;
height: 30px;
padding-right: 30px;
}
input[type="submit"] {
position: absolute;
left: 340px;
top: 16px;
background: url(https://cdn2.iconfinder.com/data/icons/arrows-and-universal-actions-icon-set/256/arrow_right_circle-32.png) no-repeat scroll 0 0 transparent;
color: #000000;
cursor: pointer;
font-weight: bold;
/* height: 20px; */
padding-bottom: 2px;
width: 82px;
background-size: 20px 19px;
border: none;
}
select {
position: absolute;
left: 225px;
top: 17px;
background: none;
border: 1px solid #DDD;
border-top: 0;
border-bottom: 0;
outline: none;
color: #DDDDDD;
}
<form action="" class="search-form">
<input type="text" class="form-control empty" id="iconified" placeholder="Search" />
<select name="" id="slctOption">
<option selected="selected" value="0">All Categories</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>
</select>
<input type="submit" value="">
</form>
This link will help you search-bar-dropdown