When I write in the email box the email, I have no problem and displays perfectly.
But when google chrome decides to autofill, the image on the left is removed.
http://s9.postimg.org/suz3z56f3/Sem_t_tulo.jpg
I've read some topics about hacking that yellow background, which works, but the image continues to disappear.
input:-webkit-autofill {
-webkit-box-shadow: 0 0 0 1000px white inset;
}
// html
<input type='email' class='email' placeholder='email'/>
// css
.email{
background-image: url('http://www.letsgocook.net/sites/default/img/email.png');
background-repeat: no-repeat;
padding-left: 35px;
}
http://jsfiddle.net/9AM6X/ > example, but no showing the error because I can't replicate the autofill of chrome in jsfiddle.
Puts the image back using keyframes:
#-webkit-keyframes autofill {
to {
background-image:url(images/your-input-bg-image.svg);
}
}
input:-webkit-autofill {
-webkit-animation-name: autofill;
-webkit-animation-fill-mode: both;
}
Kudos to #Steve for his answer to Removing input background colour for Chrome autocomplete?
I'm posting a solution here, essentially as a hack / workaround for the problem described.
Using extra elements we can place the icon on the input element.
Preview: http://output.jsbin.com/necigedago
Working Example:
CSS
.control {
position: relative;
}
.email {
padding-left: 35px;
padding-top: 10px;
padding-bottom: 10px;
font-size: 16px;
}
.email ~ .input-icon {
background-image: url('http://www.letsgocook.net/sites/default/img/email.png');
background-repeat: no-repeat;
background-size: 100%;
background-position: center center;
width: 22px;
height: 14px;
position: absolute;
left: 8px;
bottom: 0;
top: 0;
margin: auto;
}
HTML
<p class='control'>
<input type='email' class='email' placeholder='email'/>
<span class='input-icon'></span>
</p>
It is very inconvenient practice to use background images for textboxes. you can change your HTML markup
html
<div class='icon'></div>
<input type='email' class='email' placeholder='email'/>
css
.email {
border:1px solid black;
padding-left: 5px;
float:left;
border-left:none;
outline:none ;
margin-left:-3px
}
.icon {
background-image: url('http://www.letsgocook.net/sites/default/img/email.png');
background-repeat: no-repeat;
background-position:center center ;
float:left;
width:30px;
height:18px;
margin-top:2px;
border:1px solid black;
border-right:none
}
I have updated the code: jsFiddle
Only option is to remove the padding where the background image would have been in webkit but you can style as such:
/* CHROME ISSUE W/ YELLOW BG */
input:-webkit-autofill#username,
input:-webkit-autofill#usernameId_new,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
-webkit-text-fill-color: #646464 !important;
-webkit-box-shadow: 0 0 0px 1000px #fff inset;
-webkit-padding-start: 8px !important;
}
The image will still work for IE, FF, etc... but for chrome will overide.
Best-
Use animate to solve this matter is the most useful way!
kudos to #wkille for his answer: https://stackoverflow.com/a/51874418/11720087
You can set a animation like this:
#keyframes clearAutofill {
to { background: 'Your-code'; }
/* e.g background: url('./img/example.png') 0 0 no-repeat #fff; */
}
input:-webkit-autofill {
animation: clearAutofill forwards;
/* 'animation-fill-mode: forwards' can keep the style you set. */
}
I found a better solution to this.
For new Chrome versions, you can just put autocomplete="new-password" in your password field and that's it. I've checked it, works fine.
You just need to add autocomplete="off" to your input field and this will solved the issue. I tried it and it works.
I found another solution which should solve the problem using JavaScript. Add the onchange to your input element, and use following function. I'm using this along with the CSS rules input:focus:invalid and input:required:valid to show different background images based on if the input is valid or not valid.
Works in Chrome and Firefox, but not for Safari it seems :(
CSS:
input:required:valid {
background: url("IMAGE_PATH_HERE") no-repeat right;
background-size: 25px;
border: 3px solid green;
}
input:focus:invalid {
background: url("IMAGE_PATH_HERE") no-repeat right;
background-size: 25px;
border: 3px solid red;
}
HTML:
<input type="text" name="name" id="name" autocomplete="name" onchange="fixAuto(this)" required>
JavaScript:
/**
* Adds background image to input fields if they are removed by the browser.
*
* #param element An input HTML element.
*/
function fixAuto(element) {
setTimeout(() => {
// Store the current value of the input field
let value = element.value;
// Store the element itself
let input = document.getElementById(element.id);
// Change the input fields value
input.value = value;
}, 0);
}
Related
For an example, check out this fiddle (not in IE, please).
(You can see a description of the control at this link.)
She uses -ms-fill-lower and -ms-fill-upper to control the color on either side of the thumb, like this:
input[type=range]::-ms-track {
width: 300px;
height: 5px;
/*remove bg colour from the track, we'll use ms-fill-lower and ms-fill-upper instead */
background: transparent;
/*leave room for the larger thumb to overflow with a transparent border */
border-color: transparent;
border-width: 6px 0;
/*remove default tick marks*/
color: transparent;
}
input[type=range]::-ms-fill-lower {
background: #777;
border-radius: 10px;
}
input[type=range]::-ms-fill-upper {
background: #ddd;
border-radius: 10px;
}
input[type=range]::-ms-thumb {
border: none;
height: 16px;
width: 16px;
border-radius: 50%;
background: goldenrod;
}
input[type=range]:focus::-ms-fill-lower {
background: #888;
}
input[type=range]:focus::-ms-fill-upper {
background: #ccc;
}
(source: brennaobrien.com)
However, as far as I can tell, the ... ::-ms- ... pseudo-elements only work in IE. In Chrome, the code above seems to have no effect. In Chrome, I just end up with this:
(source: brennaobrien.com)
What can I do to achieve this effect cross-browser?
Thanks!
You can achieve this effect using gradient, look here: http://codepen.io/ryanttb/pen/fHyEJ
For example:
input::-moz-range-track{
background: linear-gradient(90deg,black 50%,grey 50%);
}
Of course you need js as well to change percentage values.
For anyone else finding this - with HTML5 now standard background-size is a great option if you don't want the fading look of a gradient. I've built my ranges around the tutorial at https://www.w3schools.com/howto/howto_js_rangeslider.asp.
So my solution was in css:
.slidecontainer {
display:inline-block;
vertical-align:middle;
width: 60%;
position:relative;
margin:5px 0;
background:url('/images/cyan_back.png') no-repeat left top;
background-size:0 14px;
border-radius:7px;
}
Then with jquery:
$('.slidecontainer').css('background-size',$(this).val()+'% 14px');
I believe this is also a bit more cross browser friendly.
So I wanted a custom select box and I did the following :
html :
<div class="select">
<select name="Step_01_Roof_Width" onChange="GetWidth();" class="Step_01_SelectBox" id="Step_01_Select_Width">
</div>
css :
.select select
{
width: 300px;
background: transparent;
padding: 5px;
font-size: 10px;
line-height: 1;
border: 0;
border-radius: 0;
height: 19px;
-webkit-appearance: none;
}
.select
{
width: 270px;
height: 19px;
border-radius: 15px;
border: black solid 1px;
background: url(/wp-content/themes/blackbird/phpwizard/HTML5Application/public_html/images/Step_01/selectarrow.png) no-repeat right white ;
}
However, this only works for chrome and safari as far as I know, firefox and IE give some problems with this. You can view it here : http://www.solar-discounter.nl/uw-pv-systeem/ If anyone has any idea on how to achieve the chrome and safari example on firefox and IE, that would be such a big help to me!
Thanks for reading.
I think this is what you are looking for : How to remove the arrow from a select element in Firefox
Add opacity:0; to .select select and a div with position absolute before your select.
You can then update the div text with javascript/jquery.
How to remove default border of button in jquery mobile?
I declare the <a> tag as a button, with custom background images as below:
<a id="btnLogin" href="../main/mainx.html" data-role="button" data-corner="false"> Login</a>
<a id="btnSignUp" href="../singup/signup.html" data-role="button" data-corner="false"> Sign Up</a>
CSS:
a{
width: 265px;
height: 38px;
margin-left: auto;
margin-right: auto;
margin-top: 5px;
border: 0px;
border-color: transparent;
display: box;
text-transform: none;
text-shadow: none;
}
#loginPage a .ui-btn-inner{
padding-top: 11px;
}
#loginPage #btnLogin{
background: transparent url(../../res/img/login_btn.png) no-repeat;
background-size: 100% 100%;
color: #FFF;
}
#loginPage #btnLogin:hover{
background: transparent url(../../res/img/login_btn_over.png) no-repeat;
background-size: 100% 100%;
}
#loginPage #btnSignUp{
background: transparent url(../../res/img/signup_btn.png) no-repeat;
background-size: 100% 100%;
color: grey;
}
#loginPage #btnSignUp:hover{
background: transparent url(../../res/img/signup_btn_over.png) no-repeat;
background-size: 100% 100%;
color: #fff;
}
The button shows within blur border like this:
Please help me.
I think that you're looking for the outline property :
a {
outline:0;
}
To override default styles for buttons in jQuery Mobile, do your modifications on class .ui-btn followed by !important for each property.
Demo: http://fiddle.jshell.net/Palestinian/8TH5d/
.ui-btn { border: none !important; }
As for the shadow, add this attribute data-shadow="false" to <a> tag.
Changing to use button element, everything works fine.
<button id="btnLogin" href="../main/mainx.html" data-role="none" data-corner="false"> Login</button>
<button id="btnSignUp" href="../singup/signup.html" data-role="none" data-corner="false"> Sign Up</button>`
Can you check the background image of button? it maybe contain border inside
IMO best way to have back buttons is to do this
$(document).on("mobileinit", function () {
$.mobile.toolbar.prototype.options.addBackBtn = true;
$.fn.buttonMarkup.defaults.corners = false;
});
However, $.fn.buttonMarkup.defaults.corners = false; doesnt remove round corners for back buttons that are automatically generated using the global options.
This solution worked fine for me
border: none !important;
box-shadow: none !important;
outline: 0;
I have page with dark background. In IE, Firefox, Chrome and Safari my checkboxes looks like this:
But Opera displays checkboxes like this:
So user cannot see if he checked the checkbox, because the tick (check-mark) is black as well.
Here is part of my css:
body {
background-attachment: fixed;
background-color: #07080A;
background-image: url('images/bg.jpg');
background-position: center top;
background-repeat: no-repeat;
border: 0 none;
color: #FFFFFF;
display: block;
font-family: Arial;
font-size: 13px;
margin: auto auto;
width: 1000px;
}
input, textarea {
width: 300px;
color: #fff;
background-color: #323232;
border: none;
font-size: 13px;
font-family: Arial;
padding: 8px 0px 8px 10px;
}
input[type="checkbox"]{
background: transparent;
width: 30px;
}
How can I change that? I would like to have appearance of checkbox the same in Opera and other browsers.
Try to override your first style using:
input[type="checkbox"] {
background: inherit;
width: 30px;
}
This will give the checkbox the background of its parent. Depending on the order of your rules and other rules, you might need to use inherit !important.
In Opera, the background property applies to the background inside the checkbox not the background outside of the checkbox. I believe what you're trying to fix is some of the issues that you can find on this page about how checkboxes are styled.
input[type="checkbox"]{
backgorund: #fff;
width: 30px;
}
Does that not work for you?
First, you have a typo in your input[type="checkbox"] line.
Second, according to this you could explicitly set the checkbox background to be white. This works in Opera.
I am currently working on an HTML5 form and using CSS3 for the styling. I have added CSS for input:required and input:valid and input:invalid to make an image get shown inside the text box.
Both the required and invalid CSS work fine but for some reason input:valid gets ignored and is just replaced with the same image as input:required.
Below is the CSS that I have used
input:required.fields, textarea:required.fields, select:required.fields
{
background:url("images/asterix.png") no-repeat;
background-position: right;
width: 200px;
background-color: white;
}
input:focus:required:invalid.fields, textarea:focus:invalid.fields, select:focus:invalid.fields
{
background:url("images/error.png") no-repeat;
background-position: right;
width: 200px;
background-color: white;
opacity: 1.0;
}
Both CSS sections above work fine without any problems but its the CSS below that for some reason is not working.
input:valid.fields, textarea:required:valid.fields, select:value.fields
{
background:url("images/tick.png");
background-position: right;
width: 200px;
background-color: white;
opacity: 1.0;
}
In case it was to do with the image not being found I made the invalid image be the tick.png image and this worked fine but the valid section never seems to get called.
Thanks for any help you can provide.
I just used the following on my form:
input[required]:invalid {
background: #efdee0 url(../images/invalid.png) no-repeat center right;
}
input[required]:valid {
background: #f3f8ed url(../images/valid.png) no-repeat center right;
}
but then my fields are all required (http://www.paul-ellis.co.uk/contact.htm)