Custom Checkbox Issue in only Edge - html

I am facing a strange problem with a checkbox that I have customized for my personal blog. I was checking for browser compatibility when I found this scenario.
The custom checkbox is working in Chrome, Firefox and IE 10. But when I checked for Edge, it is not working and the styles are not getting applied.
label {
display: inline-block;
max-width: 100%;
}
input[type='checkbox'] {
display: none;
box-sizing: border-box;
padding: 0;
outline: none;
border: none;
background: transparent;
width: auto;
}
input[type='checkbox']:checked+.tick_mark {
color: #16a0de;
}
input[type='checkbox']+span {
cursor: pointer;
font-weight: normal;
font-size: 11px;
}
.tick_mark {
border: 1px solid #666;
padding: 0px 1px;
color: white;
margin: 6px 4px 6px 0;
font-weight: normal;
}
<label>
<input name="postSelected" class="NonUnSaved" id="chkBlog" type="checkbox" value="4">
<span class="tick_mark">✔</span>
<span class="btntooltip" data-val="checkboxTest">Text 1</span>
</label>

Why this is happening
Edge is defaulting to the Segoe UI Emoji font for the emoji instead of Segoe UI Symbol.
How to fix it
To get a consistent result add font-family: Segoe UI Symbol; to .tick_mark.
label {
display: inline-block;
max-width: 100%;
}
input[type='checkbox'] {
display: none;
box-sizing: border-box;
padding: 0;
outline: none;
border: none;
background: transparent;
width: auto;
}
input[type='checkbox']:checked+.tick_mark {
color: #16a0de;
}
input[type='checkbox']+span {
cursor: pointer;
font-weight: normal;
font-size: 11px;
}
.tick_mark {
border: 1px solid #666;
color: white;
margin: 6px 4px 6px 0;
font-weight: normal;
font-family: Segoe UI Symbol;
line-height: 1em;
min-width: 1em;
min-height: 1em;
display: inline-block;
text-align: center;
}
<label>
<input name="postSelected" class="NonUnSaved" id="chkBlog" type="checkbox" value="4">
<span class="tick_mark">✔</span>
<span class="btntooltip" data-val="checkboxTest">Text 1</span>
</label>

Related

Hover effects on Form Placeholder Text

I am trying to change the color of the placeholder text of a contact form when hovering over it. Is this possible using only html/CSS or is javascript necessary?
You will see in the code below that I have put each input field of the contact form within its own div in order structure it properly on the page, which results in some long and messy code. But otherwise it has worked well. I have the background of the input fields set to change when hovering.
What I don't understand is why using the hover selector on the form to make the text bold works on BOTH the placeholder text and the input text; however, changing the color on hover works ONLY on the input text and NOT to placeholder.
I tried nesting the ::placeholder selector (as well as its counterparts for various web browsers) inside the hover selector in the SCSS document to change the color when hovering but with no luck.
Does anyone have any advice for how to make this placeholder text color change when hovering?
I included some images of the site and my code below.
Thanks!
Contact form as is.
Contact form on hover; placeholder text color not changing.
HTML & CSS CODE
.contact-form {
text-align: center;
justify-content: center;
position: relative;
}
.name {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
width: 40vw;
padding: 0;
}
.first {
float:left;
width: 50%;
padding: 0.5em;
padding-left: 0;
margin: 0;
}
.form-control-first {
color: #878F93;
background-color: white;
border: none;
border-radius: 1em;
box-shadow: rgba(0, 0, 0, 0.1) 0em 0em 1em 0em;
padding: 1em;
font-family: Circe;
font-weight: 300;
font-size: 1em;
margin-top: 1em;
margin-bottom: 1em;
width: 100%;
}
.form-control-first:hover {
color: white;
font-weight: 600;
background-color: #AEBDB2;
cursor: pointer;
}
.form-control-first:focus {
outline: none;
pointer-events: none;
}
.last {
float:left;
width: 50%;
padding: 0.5em;
padding-right: 0;
margin: 0;
}
.form-control-last {
background-color: white;
color: #878F93;
border: none;
border-radius: 1em;
box-shadow: rgba(0, 0, 0, 0.1) 0em 0em 1em 0em;
padding: 1em;
font-family: Circe;
font-weight: 300;
font-size: 1em;
margin-top: 1em;
margin-bottom: 1em;
width: 100%;
}
.form-control-last:hover {
color: white;
font-weight: 600;
background-color: #AEBDB2;
cursor: pointer;
}
.form-control-last:focus {
outline: none;
pointer-events: none;
}
.email-message {
position: relative;
top: 5.5em;
bottom: 0;
left: 0;
right: 0;
padding-top: 0em;
margin: auto;
width: 40vw;
}
.form-control-email {
background-color: white;
color: #878F93;
border: none;
border-radius: 1em;
box-shadow: rgba(0, 0, 0, 0.1) 0em 0em 1em 0em;
padding: 1em;
font-family: Circe;
font-weight: 300;
font-size: 1em;
margin: 0;
margin-top: 0.5em;
margin-bottom: 0.5em;
width: 100%;
}
.form-control-email:hover {
color: white;
font-weight: 600;
background-color: #AEBDB2;
cursor: pointer;
}
.form-control-email:focus {
outline: none;
pointer-events: none;
}
.form-control-message {
background-color: white;
color: #878F93;
border: none;
border-radius: 1em;
box-shadow: rgba(0, 0, 0, 0.1) 0em 0em 1em 0em;
padding: 1em;
text-align: left;
font-family: Circe;
font-weight: 300;
font-size: 1em;
margin: 0;
margin-top: 0.5em;
margin-bottom: 0.5em;
width: 100%;
height: 30vh;
max-width: 100%;
max-height: 30vh;
}
.form-control-message:hover {
color: white;
font-weight: 600;
background-color: #AEBDB2;
cursor: pointer;
}
.form-control-message:focus {
outline: none;
pointer-events: none;
}
.form-control-submit {
justify-content: center;
align-items: center;
padding: 0.75em;
padding-left: 2em;
padding-right: 2em;
font-family: Circe;
font-weight: bold;
font-size: 0.75em;
text-transform: uppercase;
color:white;
border-radius: 2em;
background-color: #207CB4;
border: none;
display: inline-block;
margin: 0px, 2px;
text-decoration: none;
}
.form-control-submit:hover {
color: #174456;
background-color: #FFE98E;
cursor: pointer;
}
::-webkit-input-placeholder { /* WebKit, Blink, Edge */
color: #878F93;
}
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
color: #878F93;
opacity: 1;
}
::-moz-placeholder { /* Mozilla Firefox 19+ */
color: #878F93;
opacity: 1;
}
:-ms-input-placeholder { /* Internet Explorer 10-11 */
color: #878F93;
}
::-ms-input-placeholder { /* Microsoft Edge */
color: #878F93;
}
::placeholder { /* Most modern browsers support this now. */
color: #878F93;
}
<div class="contact-form">
<form id="contact-form" method="post">
<div class="name">
<div class="first">
<input name="first-name" type="text" class="form-control-first" placeholder="First Name" required>
</div>
<div class="last">
<input name="last-name" type="text" class="form-control-last" placeholder="Last Name" required>
</div>
<br>
</div>
<div class="email-message">
<input name="email" type="text" class="form-control-email" placeholder="Email" required>
<br>
<textarea name="message" class="form-control-message" placeholder="Type your message here." row="4" required></textarea>
<br>
<input type="submit" class="form-control-submit" value="Submit"></div>
</form>
</div>
This worked for me!
.input {
}
.input::placeholder {
color: red;
}
.input:hover::placeholder {
color: blue;
}

Why this Custom Input file is not working in Edge?

Hell, I am building a customized input file, it's working on Chrome, FF, Safari, but not on Edge, any idea?
Here's my demo. Please open it on Chrome then on Edge to understand the issue:
/* /////////////////Custom Upload input///////////// */
.custom-file-input::-webkit-file-upload-button {
visibility: hidden;
-webkit-appearance: none;
}
.custom-file-input::-ms-file-upload-button {
visibility: hidden;
-ms-appearance: none;
}
.custom-file-input::before {
content: 'Attach';
display: inline-block;
background-color: #c6c6c6;
border: none;
width: 50px;
font-family: Roboto, sans-serif, FontAwesome;
border-radius: 3px;
padding: 5px 8px;
outline: none;
white-space: nowrap;
-webkit-user-select: none;
font-weight: normal;
font-style: normal;
font-stretch: normal;
cursor: pointer;
color: #ffffff;
font-size: 12px;
text-align: center;
}
.custom-file-input:hover::before {
border-color: black;
}
.custom-file-input:active::before {
background: -webkit-linear-gradient(top, #e3e3e3, #f9f9f9);
}
<input class="custom-file-input" type="file">
You should use ::-ms-browse to style the file input button in Edge. Then we must wrap input type file with label and do something in CSS. And if you want to change the default file input box in Edge, you need to hide it first using input[type="file"] { opacity: 0;} and combine js code to show the file name. You could check my sample of styling input type file in Edge and Chrome below:
$('input[type=file]').change(function(e) {
$in = $(this);
$in.next().html($in.val());
});
.custom-file-input::-webkit-file-upload-button {
visibility: hidden;
-webkit-appearance: none;
}
::-ms-browse {
display:none;
}
input[type="file"] {
display: input-block;
width: 100%;
height: 30px;
opacity: 0;
cursor:pointer;
position:absolute;
left:0;
}
.custom-file-input::before {
content: 'Attach';
display: inline-block;
background-color: #c6c6c6;
border: none;
width: 50px;
font-family: Roboto, sans-serif, FontAwesome;
border-radius: 3px;
padding: 5px 8px;
outline: none;
white-space: nowrap;
-webkit-user-select: none;
font-weight: normal;
font-style: normal;
font-stretch: normal;
cursor: pointer;
color: #ffffff;
font-size: 12px;
text-align: center;
}
.custom-file-input:hover::before {
border-color: black;
}
.custom-file-input:active::before {
background: linear-gradient(top, #e3e3e3, #f9f9f9);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<label class="custom-file-input">
<input type="file">
<span class="fileName">Choose file...</span>
</label>

Why is padding not applying equally on two elements?

I want to apply the same class to two different elements and am noticing that the padding surrounding each element (or at least their heights) is different.
Here is the fiddle -- https://jsfiddle.net/v9vnru0j/1/ . How do I make both elements the same height (which I interpret to be having the padding apply equally to both)?
.btn {
font-family: "Montserrat", "HelveticaNeue", "Helvetica Neue", sans-serif;
font-weight: 400;
font-style: normal;
letter-spacing: 0.1em;
text-transform: uppercase;
padding: 12px 20px;
font-size: 0.8125em;
text-rendering: optimizeLegibility;
max-width: 100%;
margin: 0;
line-height: 1.42;
text-decoration: none;
text-align: center;
vertical-align: middle;
white-space: normal;
border: 1px solid transparent;
-moz-user-select: none;
-moz-appearance: none;
border-radius: 0;
background-color: #1c1d1d;
color: #fff;
text-indent: 0rem;
}
<span class="buttonContainer"><a class="btn" data-no-turbolink="true" href="/my_objects/index">Cancel</a></span>
<span class="buttonContainer"><input type="submit" name="commit" value="Save" method="put" class="btn"></span>
That's because both links and inputs are inline by default.
However, inputs are replaced elements, and that makes them behave closer to inline-blocks.
Therefore, the solution is
.btn {
display: inline-block;
}
.btn {
display: inline-block;
font-family: "Montserrat","HelveticaNeue","Helvetica Neue",sans-serif;
font-weight: 400;
font-style: normal;
letter-spacing: 0.1em;
text-transform: uppercase;
padding: 12px 20px;
font-size: 0.8125em;
text-rendering: optimizeLegibility;
max-width: 100%;
margin: 0;
line-height: 1.42;
text-decoration: none;
text-align: center;
vertical-align: middle;
white-space: normal;
border: 1px solid transparent;
-moz-user-select: none;
-moz-appearance: none;
border-radius: 0;
background-color: #1c1d1d;
color: #fff;
text-indent: 0rem;
}
.buttonContainer *:hover {
margin: 0 0 0px 0;
text-rendering: optimizeLegibility;
cursor: pointer;
background-color: silver;
}
<span class="buttonContainer"><a class="btn" data-no-turbolink="true" href="/my_objects/index">Cancel</a></span>
<span class="buttonContainer"><input type="submit" name="commit" value="Save" method="put" class="btn"></span>
But on Firefox there is still a 2px difference. It might be that the value of the input is placed inside an inner wrapper. You can specify a height to fix this.
.btn {
display: inline-block;
height: 1.42em; /* Same as line-height */
box-sizing: content-box;
}
.btn {
display: inline-block;
height: 1.42em;
box-sizing: content-box;
font-family: "Montserrat","HelveticaNeue","Helvetica Neue",sans-serif;
font-weight: 400;
font-style: normal;
letter-spacing: 0.1em;
text-transform: uppercase;
padding: 12px 20px;
font-size: 0.8125em;
text-rendering: optimizeLegibility;
max-width: 100%;
margin: 0;
line-height: 1.42;
text-decoration: none;
text-align: center;
vertical-align: middle;
white-space: normal;
border: 1px solid transparent;
-moz-user-select: none;
-moz-appearance: none;
border-radius: 0;
background-color: #1c1d1d;
color: #fff;
text-indent: 0rem;
}
.buttonContainer *:hover {
margin: 0 0 0px 0;
text-rendering: optimizeLegibility;
cursor: pointer;
background-color: silver;
}
<span class="buttonContainer"><a class="btn" data-no-turbolink="true" href="/my_objects/index">Cancel</a></span>
<span class="buttonContainer"><input type="submit" name="commit" value="Save" method="put" class="btn"></span>
All of the styling that you have in your two buttons is at btn. However in one of your buttons your btn is being addressed inside an href tag and is not being hit.
I would go on your html
<span class="btn"><a data-no-turbolink="true" href="/my_objects/index">Cancel</a></span>
<span class="btn"><input type="submit" name="commit" value="Save" method="put"></span>
If you happen to need that other class, then just set it as
<span class="buttonContainer btn">
That should do the trick.
You need to change line-height to 1.

:before element not displaying properly in firefox

Why does firefox misplace the :before element??
<div id='remember_forgot' class='no_hl'>
<div>
<input id='remember_me' type='checkbox'>
<label for='remember_me'>Remember me</label>
</div>
</div>
* {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.3;
font-weight: normal;
}
input[type='checkbox'] {
display: none;
}
#remember_forgot {
display: flex;
align-items: center;
justify-content: space-between;
margin: 2px 0;
}
#remember_forgot>div {
position: relative;
display: flex;
align-items: center;
}
#remember_me+label:before {
position: relative;
top: 1px;
content: "";
display: block;
float: left;
width: 13px;
height: 13px;
margin-right: 4px;
font-size: 15px;
line-height: 0.8;
border: 1px solid black;
}
#remember_me:checked+label:before {
content:'✓';
color: black;
}
#remember_me+label {
display: inline-block;
margin-left: 0px;
color: black;
font-size: 13px;
}
#remember_me+label:hover {
color: #e1b941;
}
#remember_me,
#remember_me+label,
#forgot {
cursor: pointer;
}
#remember_me+label {
transition: 0.2s all;
}
All of the relevant code is here in the fiddle: http://jsfiddle.net/kjf8h5m6/7/
When I open it in chrome the checkbox :before element is properly centered:
But when it is viewed in firefox the checkbox looks like it is not centered:
This is very annoying.. please help!
(Left is chrome, right is firefox)
Removing the wildcard line-height: *{line-height:1.3;}, and adding a line-height of 1.5 to the label element solves this in both Firefox and Chrome.
Working fix: http://jsfiddle.net/kjf8h5m6/9/

Removing height difference

So I have a label and a field. But for some reason they don't seem to align. Here's my markup
<span class="hash">#</span>
<input type="text" class="hex" maxlength="6">
And the CSS.
.hex {
width: 385px;
height: 40px;
font-size: 30px;
font-family: 'proxima_novalight';
outline: none;
background: none;
border: 3px solid black;
}
.hash {
font-size: 51px;
font-family: 'proxima_novalight';
}
I want to align the # with the field. I've tried line-height, but that didn't work. Here's a demo
You need to set vertical-align:middle for both the elements:
.hex {
width: 385px;
height: 40px;
font-size: 30px;
font-family: 'proxima_novalight';
outline: none;
background: none;
border: 3px solid black;
vertical-align:middle; /* add this */
}
.hash {
font-size: 51px;
font-family: 'proxima_novalight';
vertical-align:middle; /* add this */
}
Demo