I have tried to customized the select drop down. But the arrow of the select is not working. I want to make it as this image. But it is how far I could reach. Here is the image of how I want it to be. Please have a look at it.
HTML
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
<div class="selectdiv ">
<label>
<select>
<option selected> Select Box </option>
<option>Option 1</option>
<option>Option 2</option>
<option>Last long option</option>
</select>
</label>
</div>
CSS
body {
background: #f2f2f2;
}
.selectdiv {
position: relative;
/*Don't really need this just for demo styling*/
float: left;
min-width: 150px;
margin: 50px 33%;
background:rgba(43, 43, 43, 0.4);
border-radius: 5px 0 0 5px;
padding: 5px;
}
.selectdiv:after {
content: '\f078';
font: normal normal normal 17px/1 FontAwesome;
color: #2B2B2B;
right: -44px;
top: 0px;
height: 33px;
padding: 15px 12px 0px 12px;
border:1px solid #2B2B2B;
border-radius: 0 5px 5px 0;
position: absolute;
}
/* IE11 hide native button (thanks Matt!) */
select::-ms-expand {
display: none;
}
.selectdiv select {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
/* Add some styling */
display: block;
width: 100%;
max-width: 150px;
margin: 5px 0px 5px 0px;
padding: 0px 24px;
font-size: 16px;
line-height: 1.75;
color: #333;
background: transparent;
-ms-word-break: normal;
word-break: normal;
border: 0;
border-bottom: 1px solid #fff;
outline:none;
}
I have added the codepen.io link here. Please look at it. https://codepen.io/anon/pen/vzKrXK
modify your .selectdiv:after css like this, change url with any image you want:
.selectdiv:after {
content: '';
background-color: #fff;
background: url(http://icocentre.com/Icons/g-arrow-down.png?size=16) no- repeat right #ddd;
-webkit-appearance: none;
background-position-x: 5px;
width: 10px;
font: normal normal normal 17px/1 FontAwesome;
color: #0ebeff;
right: 11px;
top: 6px;
height: 34px;
padding: 15px 0px 0px 8px;
border-left: 1px solid #0ebeff;
position: absolute;
pointer-events: none;
}
Related
I have a form in which one input field is select and it has few option.I am not able to increase the height of the option box and background color.presently it has white colour as given in the picture My html code and css code is below
.select2 {
width: 100%;
overflow: hidden;
font-size: 20px;
padding: 4px 0;
margin: 4px 0;
border-bottom: 2px solid black;
background-color: transparent;
}
.select2 option{
width: 26px;
background-color: none ;
border: none;
background: none;
color: blue;
font-size: 20px;
font-weight:bold;
float: left;
margin: 0 10px;
white-sapce: no-wrap;
text-overflow: ellipsis;
}
.select2 after {
!content: 'Select Role';
font-family: 'material icons';
font-size: 24px;
color: red;
position: absolute;
right: 10px;
top: 10%;
transform: translateY(-50%);
pointer-events: none;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.13.0/css/all.css">
<div class="select2">
<i class="fas fa-user-lock" style="color:black; padding:10px;"> Role</i>
<select >
<option value=""></option>
<option value="user">USER</option>
<option value="rec">Recommending Officer</option>
<option value="store">Store</option>
</select>
</div>
You can use this to increase height:
.select2 select{
height: 50px;
background: transparent;
}
Add more properties here to style the box.
Also correct way to use before and after is :
.select2::after {
....
}
Codepen
Try giving style to select tag, this might works!
select{
width: 50%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
font-size: 20px;
}
Try this
.select2 {
width: 100%;
overflow: hidden;
font-size: 20px;
padding: 4px 0;
margin: 4px 0;
}
select{
height:30px;
border-bottom: 2px solid black;
background-color: transparent;
}
few days ago I've asked for help with styling input type range element. Everything works just fine except one thing. Slider thumb is not displaying correctly.
My goal is to display it like this.
But this is the closest to my goal I can do.
There are two problems with that slider thumb. As you can see it's cropped and not standing out like in my goal picture. I know that it is caused by overflow : hidden. But that overflow:hidden is there on purpose ,because that is the approach I've got as a advice on my last question. Next problem is with color and box-shadow of slider thumb. I've switched it to red so it's more visible when I tried to fix the first problem. But if I switch it back to white, and try to add box shadow to it to achieve that effect which is in goal picture ,it will overwrite old box-shadow,which is making that white 'selected' effect.
Does anybody encountered this type of problem or have another solution for this ? Thank you :)
body{
background:#ccc;
}
#media screen and (-webkit-min-device-pixel-ratio:0) {
input[type='range'] {
width: 100%;
-webkit-appearance: none;
background-color: #ee7b82;
border-radius: .3em;
position: relative;
}
input[type='range']::-webkit-slider-runnable-track {
height: .35em;
border: none;
border-radius: 3px;
color: white;
overflow: hidden;
}
input[type='range']::-webkit-slider-thumb {
-webkit-appearance: none;
cursor: ew-resize;
box-shadow: -100em 0 0 100em white;
-webkit-appearance: none;
border: none;
height: 1.1em;
width: 1.1em;
border-radius: 50%;
background:red;
/*
Box-shadow to slider thumb,when color is changed to white,so it'll be visible, but it rewrites old box-shadow ,which is making that selected effect.
background: white;
-webkit-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.75);
-moz-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.75);
box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.75);
*/
margin-top: -.2em;
}
input[type=range]:focus {
outline: none;
}
}
/*MOZ*/
input[type="range"]::-moz-range-progress {
background-color: white;
}
input[type="range"]::-moz-range-track {
background-color: #ee7b82;
}
/*IE*/
input[type="range"]::-ms-fill-lower {
background-color: white;
}
input[type="range"]::-ms-fill-upper {
background-color: #ee7b82;
}
<div className="range">
<p className="heading">HEIGHT</p>
<input type="range"></input>
<p className="heading">WEIGHT</p>
<input type="range"></input>
</div>
change in the CSS
input[type='range'] {
width: 100%;
-webkit-appearance: none;
background-color: #ee7b82;
border-radius: .3em;
position: relative;
max-height: 2px;
}
Please try instead,
First problem change color of thumb
By using this for different browser.
::-webkit-slider-thumb //for WebKit/Blink
::-moz-range-thumb //for Firefox
::-ms-thumb //for IE
I added box-shadow as well
box-shadow: 0px 0px 3px 2px white;
body{
background:#ccc;
}
#media screen and (-webkit-min-device-pixel-ratio:0) {
input[type='range'] {
-webkit-appearance: none;
width: 100%;
background-color: #ccc !important;
border-radius: .3em;
position: relative;
height: 1.1em;
overflow: hidden;
}
input[type='range']::-webkit-slider-runnable-track {
-webkit-appearance: none;
height: .35em;
border: none;
border-radius: 3px;
color: white;
background:#fff;
}
input[type='range']::-moz-range-thumb{
-webkit-appearance: none;
cursor: ew-resize;
box-shadow: 0px 0px 3px 2px white;
-webkit-appearance: none;
border: none;
height: 1.1em;
width: 1.1em;
border-radius: 50%;
background:red;
margin-top: -.2em;
}
input[type='range']::-ms-thumb{
-webkit-appearance: none;
cursor: ew-resize;
box-shadow: 0px 0px 3px 2px white;
-webkit-appearance: none;
border: none;
height: 1.1em;
width: 1.1em;
border-radius: 50%;
background:red;
margin-top: -.2em;
}
input[type='range']::-webkit-slider-thumb {
-webkit-appearance: none;
cursor: ew-resize;
box-shadow: 0px 0px 3px 2px white;
border: none;
height: 1.1em;
width: 1.1em;
border-radius: 50%;
background:red;
margin-top: -.35em;
}
input[type=range]:focus {
outline: none;
}
}
/*MOZ*/
input[type="range"]::-moz-range-progress {
background-color: white;
}
input[type="range"]::-moz-range-track{
background-color: #ee7b82;
}
/*IE*/
input[type="range"]::-ms-fill-lower {
background-color: white;
}
input[type="range"]::-ms-fill-upper {
background-color: #ee7b82;
}
<div className="range">
<p className="heading">HEIGHT</p>
<input type="range"></input>
<p className="heading">WEIGHT</p>
<input type="range"></input>
</div>
I have a requirement of displaying the image/icon on top of the modal box in a semicircle. Though I have achieved it with the help of below code, but the only issue is whenever my form in the modal box goes for a validation check, displaying any error, my semicircle doesn't get adjusted accordingly, rather it stays at its position. Here, I have attached the screen shot of what exactly I am looking for and HTML/css code I have used to display the semicircle with image/icon at the top.
.modal {
font-family: Avenir-Medium;
font-size: 16px;
font-weight: 900;
font-style: normal;
font-stretch: normal;
display: block;
/*Hidden by default */
position: fixed;
/* Stay in place */
z-index: 1;
/* Sit on top */
left: 0;
top: 0;
width: 100%;
/* Full width */
height: 100%;
/* Full height */
overflow: auto;
/* Enable scroll if needed */
background-color: rgb(0, 0, 0);
/* Fallback color */
background-color: rgba(0, 0, 0, 0.3);
/* Black w/ opacity */
-webkit-animation-name: slideIn;
/* Fade in the background */
-webkit-animation-duration: 2.0s;
/* Fade in the background */
;
}
/* Modal Content */
.modal-content {
position: fixed;
bottom: 0;
background-color: #fefefe;
width: 92%;
left: 14px;
-webkit-animation-name: fadeIn;
-webkit-animation-duration: 0.5s;
border-radius: 16px 16px 0px 0px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
border: none;
top: auto;
}
.modal-wrapper {
line-height: 45px;
border: 1px solid #e7e9ea;
border-radius: 6px 6px 0px 0px;
background-color: white;
margin: auto;
}
.modal-wrapper::after {
background: url("../../../../images/mobile/img-payment_38.png") no-repeat 22px 10px;
background-size: 50%;
background-color: #fff;
content: '';
width: 78px;
height: 45px;
position: absolute;
left: 0;
right: 0;
margin: auto;
border-radius: 78px 78px 0 0;
border-left: 1px solid #e7e9ea;
border-top: 1px solid #e7e9ea;
border-right: 1px solid #e7e9ea;
border-bottom: 3px solid white;
bottom: 300px;
}
.close-btn {
position: absolute;
vertical-align: top;
top: 4px;
left: 320px;
width: 18px;
height: 18px;
}
.container-div-creditCard {
margin: 12px 20px 0px 20px;
}
.container-div-creditCard>img {
position: absolute;
bottom: 154px;
right: 30px;
}
.credit-card-modal-label {
font-family: AvenirHeavy;
font-size: 13px;
color: #1d3444;
text-align: center;
font-weight: 200;
height: 24px;
margin-left: 31px;
}
.input-modal {
width: 100%;
height: 44px;
}
.input-spacing {
margin-top: 15px;
}
.credit-input-modal {
border: solid 1px #e7e9ea;
border-radius: 5px;
font-family: Avenir-Book;
font-size: 14px;
font-weight: normal;
color: #8589a1;
line-height: initial;
padding: 13px 42px 12px 15px;
}
.credit-expiry-input-modal {
padding: 13px 27px 12px 10px;
border: solid 1px #e7e9ea;
border-radius: 5px;
font-family: Avenir-Book;
font-size: 14px;
font-weight: normal;
color: #8589a1;
display: inline-block;
line-height: initial;
width: 65%;
height: 44px;
}
.credit-cvc-input-modal {
width: 30%;
padding: 17px 5px 12px 10px;
border: solid 1px #e7e9ea;
border-radius: 5px;
font-family: Avenir-Book;
font-size: 14px;
font-weight: normal;
color: #8589a1;
line-height: initial;
height: 44px;
}
.cvvDisc {
-webkit-text-security: disc;
}
.credit-submit-button {
width: 100%;
padding: 13px;
margin-top: 15px;
border: solid 1px #e7e9ea;
border-radius: 5px 5px 5px 5px;
background: linear-gradient(to right, #e32490, #ed1a3d);
color: white;
margin-bottom: 20px;
font-family: Avenir-Book;
font-weight: normal;
font-size: 14px;
line-height: initial;
}
.errorMsg {
font-family: Avenir-Book;
font-weight: normal;
color: #ED1A3D;
font-size: 12px;
}
<div id="modalCCDetails" class="modal">
<div class="modal-content modal-wrapper">
<div class="container-div-creditCard">
<label class="credit-card-modal-label">ENTER YOUR CREDIT CARD DETAILS</label>
<input name="cc_name" class="input-modal credit-input-modal" type="text" placeholder="Name printed on Credit Card" onChange={this.handleUserInput} />
<span class="errorMsg"></span>
<input name="cc_number" class="input-modal credit-input-modal input-spacing" type="tel" maxLength="16" onKeyPress={(e)=> this.handleCCOnKeyPress(e)} placeholder="16 digit credit card number" />
<span class="errorMsg"></span>
<input name="cc_expDate" class="credit-expiry-input-modal" type="text" placeholder="Expiry MM-YYYY" />
<div class="device-divider" />
<input name="cc_cvc" class="credit-cvc-input-modal cvvDisc" type="tel" placeholder="CVC" maxLength="3" />
<span class="errorMsg"></span>
</div>
<button class="credit-submit-button">Submit Payment</button>
</div>
</div>
</div>
NOTE: This is a mobile view screenshot
Just adjust your css code into something like this:
.modal-wrapper::after {
background: url("../../../../images/mobile/img-payment_38.png") no-repeat 22px 10px;
background-size: 50%;
background-color: #fff;
content: '';
width: 78px;
height: 45px;
position: absolute;
left: 0;
right: 0;
margin: auto;
border-radius: 78px 78px 0 0;
border: 1px solid #e7e9ea;
border-bottom: 3px`enter code here` solid white;
top: -48px;
}
Just remove the bottom: 300px; and replace with top: -48px; or any value that you want.
please add top:-15px; and removed bottom:300px; in class .modal-wrapper::after { top: -15px; }, u will see the image move up
I have created a custom dropdown box which can be seen here: JSFIDDLE.
The lay-out is just what I wanted and within Chrome and Firefox it works perfectly. But the problems lies within IE (11,10,9,8). When you try to click on the blue arrow nothing happens. While if you click on the blue arrow in Chrome or Firefox the dropdown will open. I tried using several CSS IE hacks but with no success. Can anyone tell me if this can be fixed?
My CSS:
select\9 {
display: none;
}
select::-ms-expand {
display: none;
}
select {
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
-o-appearance: none;
appearance: none;
text-overflow: '';
/* this is important! */
}
.custom-select {
position: relative;
overflow: hidden;
border: 1px solid #cacaca;
background-color: #fff;
border-radius: 2px;
box-shadow: inset 0 1px 1px 1px rgba(204, 204, 204, .4);
color: #0085c8;
width:200px;
}
.custom-select:after {
background-color: #fff;
border-left: 1px solid #cacaca;
content: "\25bc";
display: block;
font-size: 1em;
line-height: 1em;
padding: 11px 13px 11px 11px;
position: absolute;
right: 13px;
text-align: center;
top: 3%;
width: 0;
z-index: 2;
box-sizing: inherit;
height:100%;
/* IE */
line-height: 3em\9;
padding: 0px 13px 0px 11px\9;
right: 0px\9;
width: 10px\9;
z-index: 4\0;
}
.custom-select select {
background: 0 0;
height: 80%;
outline: 0;
width: 100%;
width: 180%\9;
font-size: 14px;
line-height:1.1em;
border: 0;
border-radius: 0;
padding: 9px 38px 9px 10px;
position: relative;
z-index: 3;
color: #0085c8;
overflow:hidden;
}
Change the CSS for .custom-select:after to match the following:
.custom-select:after {
background-color: #fff;
border-left: 1px solid #cacaca;
content: "\25bc";
display: block;
font-size: 1em;
line-height: 1em;
padding: 11px 13px 11px 11px;
position: absolute;
right: 13px;
text-align: center;
top: 3%;
width: 0;
z-index: 2;
box-sizing: inherit;
height:100%;
/* IE */
line-height: 3em\9;
padding: 0px 13px 0px 11px\9;
right: 0px\9;
width: 10px\9;
z-index: 1;
}
I am implementing a search box for a html-javascript based app using Chrome:
fiddle
it should look like this:
but when I deploy app on iphone,
screen looks like this:
I know it's difference with webkit, I thought using safari to debug it would be a solution, however,when I use safari to open it, it looks like this:
Just don't know why on iPhone, it looks like that. How to improve it to the feature which I need?
Here is the html:
<div class="form-wrapper">
<input type="text" placeholder="Search here..." required>
<button type="submit">Search</button>
</div>
CSS:
.form-wrapper {
height: 80px;
background: #555;
color: #FFF;
clear: both;
}
.form-wrapper input {
background-color: #FFF;
-moz-box-sizing: border-box;
border-radius: 10px;
border: 5px solid #E5E4E2;
margin: 2px;
height: 40px;
vertical-align: middle;
padding: 20px;
margin-top: 15px;
width: 85%;
}
.form-wrapper button {
overflow: visible;
position: absolute;
float: right;
border: 0;
padding: 0;
cursor: pointer;
height: 40px;
width: 110px;
color: #FFF;
text-transform: uppercase;
background: red;
border-radius: 0 3px 3px 0;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
margin: 20px -116px;
}
.form-wrapper button:before {
content:'';
position: absolute;
border-width: 8px 8px 8px 0;
border-style: solid solid solid none;
border-color: transparent red transparent;
top: 12px;
left: -6px;
}
type="search" causes the field to have a -webkit-appearance: searchfield on Safari, which causes lots of your styles to be ignored.
Have either a none appearance or textfield appearance.
Here is a fiddle with none, which seems to work for me on Safari 6/OSX (no iDevice available to test).