I am trying to style the input slider in my application. I have the <input type="text"> and <input type="range"> tags dependent on each other. I am facing two problems.
1.When I refresh the document the color on the left of the slider has a default width independent of the <input type="text">
2.When an input in given in <input type="text"> the color doesn't properly vary in the slider (The slider thumb moves though).
input[type="range"]{
-webkit-appearance: none;
-moz-apperance: none;
border-radius: 6px;
height: 8px;
background-image: -webkit-gradient(
linear,
left top,
right top,
color-stop(0.15, #94A14E),
color-stop(0.15, #C5C5C5)
);
}
input[type='range']::-webkit-slider-thumb {
-webkit-appearance: none !important;
background-color: #ffffff;
border: 1px solid #CECECE;
height: 18px;
width: 18px;
border-radius: 50%;
}
<form>
<div id="loanAmount">
<div id="loanAmountText" class="input-group">
<span class="input-group-addon">Loan Amount</span>
<input type="number" step="any" oninput="rangeInput.value=loanAmount.value" id="amountBox" placeholder="eg.1100000" value="1100000" name="loanAmount" for="rangeInput" oninput="rangeInput.value=loanAmount.value" class="form-control" required/>
<span class="input-group-addon input-group-addon-right"><i class="fa fa-rupee" style="font-size:20px"></i></span>
</div>
<div id="amountSlide">
<input for="loanAmount" oninput="loanAmount.value=rangeInput.value" id="amountSlider" type="range" min="100000" max="10000000" name="rangeInput" required value="5000000" />
</div>
</div>
</form>
Could you please let me know what am I missing?
Related
I'd like to style a file input that a plugin I bought generates in the frontend to a nice CSS button.
I read many posts and articles how to style file inputs by using the label and hiding the input. However, in my case this doesn't work as the label isn't directly adjacent to the input.
Is there another way to somehow style this beautifully and get rid of the ugly grey default "choose file" button and the "no file chosen"?
I'd very much appreciate any help!
Many thanks
JSFiddle: https://jsfiddle.net/AlphaX/0zanegc8/
<p class="form-row thwcfe-input-field-wrapper" id="additional_upload_field" data-priority="40" data-rules="" data-rules-action="" data-validations="">
<label for="additional_upload" class="">Example files <span class="optional">(optional)</span></label>
<span class="woocommerce-input-wrapper">
<input type="hidden" class="thwcfe-checkout-file-value input-text thwcfe-input-field" name="additional_upload" id="additional_upload" value="" data-nonce="6467d03bb7">
<input type="file" class="thwcfe-checkout-file " name="additional_upload_file" id="additional_upload_file" placeholder="" value="" multiple="">
<span class="thwcfe-uloaded-files" style="display:none;">
<span class="thwcfe-upload-preview" style="margin-right:15px;">
</span></span>
<span class="thwcfe-file-upload-status" style="display:none;">
<img src="https://auraly.de/wp-content/plugins/WC plugin Themehigh checkout fiel editor-pro/public/assets/css/loading.gif" style="width:32px;"></span>
<span class="thwcfe-file-upload-msg" style="display:none; color:red;"></span>
</span>
</p>
Unfortunately, using a label is your best bet unless you decide to use a CSS framework like bootstrap to handle this for you.
I know you mentioned your labels not being adjacent to the input. If possible, just wrap an additional label around your input specifically for this purpose.
Note: Make sure your label's for attribute matches up with your inputs id.
See the example below:
.fancy-upload {
border: 1px solid #ccc;
background-color: blue;
color: white;
display: inline-block;
padding: 5px 10px;
cursor: pointer;
}
#additional_upload_file {
display: none;
}
<p class="form-row thwcfe-input-field-wrapper" id="additional_upload_field" data-priority="40" data-rules="" data-rules-action="" data-validations="">
<label for="additional_upload" class="">Example files <span class="optional">(optional)</span></label>
<span class="woocommerce-input-wrapper">
<label for="additional_upload_file" class="fancy-upload">
FANCY UPLOAD
<input type="hidden" class="thwcfe-checkout-file-value input-text thwcfe-input-field" name="additional_upload" id="additional_upload" value="" data-nonce="6467d03bb7">
<input type="file" class="thwcfe-checkout-file " name="additional_upload_file" id="additional_upload_file" placeholder="" value="" multiple="">
</label>
<span class="thwcfe-uloaded-files" style="display:none;">
<span class="thwcfe-upload-preview" style="margin-right:15px;">
</span></span>
<span class="thwcfe-file-upload-status" style="display:none;">
<img src="https://auraly.de/wp-content/plugins/WC plugin Themehigh checkout fiel editor-pro/public/assets/css/loading.gif" style="width:32px;"></span>
<span class="thwcfe-file-upload-msg" style="display:none; color:red;"></span>
</span>
</p>
EDIT: You can also use the ::file-selector-button CSS pseudo element but it's not widely supported.
input[type=file]::-webkit-file-upload-button {
border: 2px solid #6c5ce7;
padding: .2em .4em;
border-radius: .2em;
background-color: #a29bfe;
transition: 1s;
}
input[type=file]::file-selector-button {
border: 2px solid #6c5ce7;
padding: .2em .4em;
border-radius: .2em;
background-color: #a29bfe;
transition: 1s;
}
input[type=file]::-webkit-file-upload-button:hover {
background-color: #81ecec;
border: 2px solid #00cec9;
}
input[type=file]::file-selector-button:hover {
background-color: #81ecec;
border: 2px solid #00cec9;
}
<p class="form-row thwcfe-input-field-wrapper" id="additional_upload_field" data-priority="40" data-rules="" data-rules-action="" data-validations="">
<label for="additional_upload" class="">Example files <span class="optional">(optional)</span></label>
<span class="woocommerce-input-wrapper">
<input type="hidden" class="thwcfe-checkout-file-value input-text thwcfe-input-field" name="additional_upload" id="additional_upload" value="" data-nonce="6467d03bb7">
<input type="file" class="thwcfe-checkout-file " name="additional_upload_file" id="additional_upload_file" placeholder="" value="" multiple="">
<span class="thwcfe-uloaded-files" style="display:none;">
<span class="thwcfe-upload-preview" style="margin-right:15px;">
</span></span>
<span class="thwcfe-file-upload-status" style="display:none;">
<img src="https://auraly.de/wp-content/plugins/WC plugin Themehigh checkout fiel editor-pro/public/assets/css/loading.gif" style="width:32px;"></span>
<span class="thwcfe-file-upload-msg" style="display:none; color:red;"></span>
</span>
</p>
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I need style required fields, but I need show style only when user click first time, and then it does not click, I would like to keep with the default color.
With effect of click first form, but with css of second form, result of box 3:
http://jsfiddle.net/rflfn/m0f6xuxd/
Note: the red box-shadow is default color of browser for tag required of HTML5 (I am not using any script).
<div class="test1">box 1<br>Appear box-shadow only on click
<br>(default browser color)
<br>show on 3 input at same time (all required fields).
<form action="#">
<input type="text">
<input type="text" required>
<input type="text" required>
<input type="text">
<input type="text" required>
<input type="text">
<input type="text">
<input type="submit" text="Send">
</form>
</div>
<div class="test2">box 2<br>Have CSS, but I need show color only when click (use standard formatting until it is clicked)
<form action="#">
<input type="text">
<input type="text" required>
<input type="text" required>
<input type="text">
<input type="text" required>
<input type="text">
<input type="text">
<input type="submit" text="Send">
</form>
</div>
<div class="test3">box 3<br>I need style all required fields with my own css (show on 3 input at same time, not only on focus input)
<form action="#">
<input type="text">
<input type="text" required>
<input type="text" required>
<input type="text">
<input type="text" required>
<input type="text">
<input type="text">
<input type="submit" text="Send">
</form>
</div>
.test1, .test2, .test3 {
width: 230px;
padding: 5px;
margin: 5px;
border: 1px solid red;
display: inline-block;
vertical-align: top;
}
form {
margin: 20px;
}
form * {
display: block;
clear: both;
margin: 10px;
}
.test2 :required {
border: 1px solid #FFF;
border-radius: 3px;
}
.test2 :required:valid {
background-color: #E8FFED;
box-shadow: 0 0 3px 1px #00EA33;
}
.test2 :required:invalid {
background-color: #FFEEEE;
box-shadow: 0 0 3px 1px #EA2034;
}
.test3 input[type="text"] {
border: 1px solid #D1D1D1;
border-radius: 3px;
}
.test3 :required {
box-shadow: none;
}
.test3 :required:focus {
border: 1px solid #FFF;
background-color: #FFEEEE;
box-shadow: 0 0 3px 1px #EA2034;
}
.test3 :required:valid {
background-color: #E8FFED;
box-shadow: 0 0 3px 1px #00EA33;
}
EDIT: No classes needed.
You can use general sibling combinator. The only problem is it will not work for elements above the one you click on. To go further you will need Javascript.
jsfiddle
Key part:
input:required:focus~input:required, input:required:focus {
border: 1px solid #FFF;
background-color: #FFEEEE;
box-shadow: 0 0 3px 1px #EA2034;
}
I am working in Bootstrap 3 and am trying to get a calendar icon inside the right hand side of the input box.
My html looks like this:
<div class="col-md-12">
<div class='right-inner-addon col-md-2 date datepicker'
data-date-format="yyyy-mm-dd">
<input name='name' value="" type="text" class="form-control date-picker"
data-date-format="yyyy-mm-dd"/>
<i class="fa fa-calendar"></i>
</div>
</div>
I have tried position: absolute like this:
.right-inner-addon i {
position: absolute;
right: 5px;
top: 10px;
pointer-events: none;
font-size: 1.5em;
}
.right-inner-addon {
position: relative;
}
But when I do it will look great in one spot, but will not be positioned correctly in another instance.
I have also tried to see if I could use text-indent to see if this would work throughout, but it had the same effect.
.right-inner-addon i,
.form-group .right-inner-addon i {
display: inline-block;
z-index: 3;
text-indent: -15px;
font-size: 1.3em;
}
Here's a jsFiddle that might help
Using bootstrap's native validation states is probably preferable to writing custom CSS here.
And I'm pretty sure that I'm the one who came up with the CSS in question.
Just use .has-feedback on your form-group and .form-control-feedback on your icon:
<div class="form-group has-feedback">
<label class="control-label sr-only">DatePicker</label>
<input type="text" class="form-control date-picker" />
<i class="fa fa-calendar form-control-feedback"></i>
</div>
Demo in jsFiddle
You can use input-group add-on with a input-group-btn.
<div class="col-md-12">
<div class='input-group add-on col-md-2 date datepicker'
data-date-format="yyyy-mm-dd">
<input name='name' value="" type="text" class="form-control date-picker"
data-date-format="yyyy-mm-dd"/>
<div class="input-group-btn">
<button class="btn btn-default">
<i class="fa fa-calendar"></i>
</button>
</div>
</div>
</div>
With a little CSS to hide the button border:
/* remove border between controls */
.add-on .input-group-btn > .btn {
border-left-width: 0;
left:-2px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
/* stop the glowing blue shadow */
.add-on .form-control:focus {
-webkit-box-shadow: none;
box-shadow: none;
border-color:#cccccc;
}
Demo: http://bootply.com/128059
Check this fiddle, adapted from this answer
The difference being that in your case the <i> was placed after <input>. Swapping them makes it work. That's why the positioning was creating a mess as opposed to the cited answer.
In above answers, Input click works but click on i tag is not working.
so I have added my code in answer of #KyleMit
<div class="form-group has-feedback">
<input type="text" name="txtDatepicker" class="form-control date-picker" />
<i class="glyphicon glyphicon-calendar"
onclick="javascript:$('input[name=txtDatepicker]').data('DateTimePicker').show();">
</i>
</div>
I changed css little bit for my UI. You also can change it.
<style>
.right-inner-addon {
position: relative;
}
.right-inner-addon input {
padding-right: 30px;
}
.right-inner-addon i {
position: absolute;
left: 256px;
padding: 14px 12px;
}
</style>
I have a form where I gave the textfields a padding so it will be a bit bigger and nicer. Underneath the form I have a submit button.
The button and the textfields have a width of 100%, but the problem is, is that the button isn't fully 100% by that it isn't equally even in the width with the textfields. What am I doing wrong? Can't seem to "find" the issue
I have put it here http://jsfiddle.net/zrhB6/3/
The Css
input[type=text],input[type=password]{
display: block;
height: 3em;
width: 100%;
}
.btn {
background-color:#c1d82f;
border:3px solid #97a34b;
display:inline-block;
color:#26328c;
font-family:Verdana;
font-size:20px;
font-weight:bold;
padding:6px 24px;
text-decoration:none;
cursor: pointer;
width: 100%;
}
HTML
<div class="grid-container">
<div class="grid-50 login">
<h3>Login</h3>
<form class="grid-100">
<input type="text" name="loginEmail" placeholder="Email"/>
<input type="password" name="loginPassword" placeholder="pass"/>
<input type="submit" name="loginSubmit" class="btn"/>
</div>
<div class="grid-50 login">
<h3>Register</h3>
<form">
<input type="text" name="registerName" placeholder="Name"/>
<input type="text" name="registerEmail" placeholder="Email"/>
<input type="password" name="registerPassword" placeholder="pass"/>
<input type="submit" name="registerSubmit" class="btn"/>
</div>
</div>
I'm using unSemantic grid, but that shouldn't be a issue I think
To both CSS selectors, add:
box-sizing:border-box;
The reason is the default box sizing doesn't include padding and margins in the width, so you're getting 100% + padding + border + margin for the total width.
If you visit my page (http://www.dentalfixrx.com/local-equipment-repair/) and click the "get started" button at the top right you will open a lightbox form.
I would like to create code so the lightbox appears on page load automatically.
Here is the code to open the lightbox currently: <img src="images/mobile-dental-repairs.gif" width="184" height="36"border="0" class="getstarted" />
simply visiting http://www.dentalfixrx.com/local-equipment-repair/download-kit.html does not work
Wrap the lightbox code into a parent div (.parent) and hide that whole div initially
HTML:
<div class="parent">
<div class="downloadkit"><form action="formmail.php" method="post" >
<input type="hidden" name="recipients" value="brian#dentalfixrx.com,billdonatojr#gmail.com,andy#dentalfixrx.com" />
<input type="hidden" name="subject"value="New DentalFixRx Lead!" />
<input type="hidden" name="good_url" value="thanks-downloadkit.php" />
<div style=" width:300px; position:absolute; right:10px; top:15px;">
<h1 style="font-size:20px; margin:5px auto;">Emergency Fix Needed?</h1>
To receive a fast response, please complete the form below and click the "submit" button.
</div>
<p><label>Name/Business:<span class="red">*</span></label><input type="text" name="name" id="name" /></p>
<p> <label> Phone:<span class="red">*</span></label> <input type="text" name="phone" id="phone" / > </p>
<p> <label>Email:<span class="red">*</span></label> <input type="text" name="email" id="email" / ></p>
<p> <label>State:</label> <input type="text" name="st" id="st" / ></p>
<p> <label>Zip Code:</label> <input type="text" name="zip" id="zip" / ></p>
<p> <label>Service Needed:</label><select name="">
<option>Select one</option>
<option>Handpiece Repair</option>
<option> -Low Speed</option>
<option> -High Speed</option>
<option> -Electric High Speed</option>
<option>Equipment Repair</option>
<option> -Autoclaves</option>
<option> -Chairs & Delivery Units</option>
<option> -Compressors</option>
<option> -Vacuum Pumps</option>
<option> -Ultrasonic Scalers</option>
<option> -Instrument Sharpening</option>
<option> -Upholstery</option>
<option> -Curing Lights</option>
<option> -Film Processors</option>
<option>Other Service</option>
</select></p>
<p> <label>Select type of request:</label><select name="">
<option>Select one</option>
<option>Just a casual question</option>
<option>I need some help but it's not super time-sensitive</option>
<option>Things are broken and I'd like them not to be!</option>
<option>I can't get things done, please reply ASAP</option>
</select></p>
<div class="clear"></div>
<input value=" " type="submit" class="download-btn" width="231px" height="36px" />
<span>Exit</span>
</form></div>
</div>
CSS:
div.parent
{
display: none;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
text-align: center;
font-family: 'Myriad Pro', Arial, sans-serif !important;
font-size: 22px !important;
border: 2px solid #aaa;
z-index: 1040;
-moz-box-shadow: 0px 0px 20px 2px #ccc;
-webkit-box-shadow: 0px 0px 20px 2px #ccc;
box-shadow: 0px 0px 20px 2px #ccc;
background: rgb(54, 25, 25); /* Fall-back for browsers that don't
support rgba */
background: rgba(255, 255, 255, .7);
}
div.downloadkit
{
position: fixed;
width: 200px;
height: 100px;
top: 50%;
left: 50%;
margin-left: -100px;
margin-top: -50px;
}
Then, on your home page of your site, add the following code: Note, this is jQuery, so just add the jquery library to your site, either in the header or just above the closing body tag -
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
Now add this code right below where you added jQuery:
<script type="text/javascript">
$(window).load(function(){ //this is pageload
$('div.parent').show(500); //500 is the animation speed
})
</script>
NOTE: If
$('div.parent').show(500);
does not work, try:
$('div.parent').css('display','block');