Styled css do not appear in firefox - html

I have a checkbox that I have styled accordingly. Like this :
input[type=checkbox] {
transform: scale(1.3);
}
input[type=checkbox] {
width: 30px;
height: 30px;
margin-right: 15px;
cursor: pointer;
font-size: 17px;
visibility: hidden;
}
input[type=checkbox]:after {
content: " ";
background-color: rgba(224, 214, 214, 0.877);
display: inline-block;
margin-left: 10px;
padding-bottom: 5px;
color: #fff;
width: 22px;
height: 25px;
visibility: visible;
border: 1px solid transparent;
padding-left: 3px;
border-radius: 5px;
}
input[type=checkbox]:checked:after {
content: "\2714";
padding: -5px;
background: red;
font-weight: bold;
}
<input type="checkbox" [(ngModel)]="Option1" />
<p>Option1</p>
I tested this and it worked in Chrome and Opera, but I forgot to check Firefox.
Now I see that the checkboxes don't appear there at all.
I understand it is an issue of using :after for checkbox, but how do I fix this ?
So that the same checkbox appears styled on the browsers?.
I am uncertain of what to do so that I keep the design.
Thank you.

Read these specifications
:before and :after should only work on the element which can act as a
container of content. cannot contain any content so it should
not support those pseudo-elements. Chrome supports because it does not
follow the spec
However you can use <span> tag next to input tag to achieve this like below. It will work on firefox as well
body {
font: 13px Verdana;
}
label {
position: relative;
display: inline-block;
text-align: center;
}
label span {
display: block;
margin-top: 10px;
cursor: pointer;
}
input[type=checkbox] {
width: 30px;
height: 30px;
cursor: pointer;
margin: 0;
opacity: 0;
}
input[type=checkbox]+span:after {
content: "";
background-color: rgba(224, 214, 214, 0.877);
color: #fff;
width: 30px;
height: 30px;
border-radius: 5px;
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
line-height: 30px;
}
input[type=checkbox]:checked+span:after {
content: "\2714";
background: red;
}
<label>
<input type="checkbox" [(ngModel)]="Option1" />
<span>Option1</span>
</label>

Related

Transforming and tranisitions in CSS | Transition not working

I have the following css file
body {
font-family: Baskerville;
background: #ecf0f1;
color: #2c3e50;
}
h1 {
margin: 16px 0;
padding-left: 16px;
border-left: 5px solid #e74c3c;
font-family: Baskerville;
font-size: 48px;
}
h3 {
margin: 16px 0;
padding-left: 16px;
color: #cccac4;
}
.container1 {
padding: center;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
}
.container1 .checkbox {
padding: 8px 48px;
margin: 8px;
font-family: Baskerville;
font-size: 25px;
}
input[type="checkbox"]{
display: none;
}
label {
position: relative;
}
label::before {
content: "";
background: url("check-circle.svg");
background-position: center;
background-size: contain;
width: 32px;
height: 32px;
position: absolute;
left: -44px;
top: -8px;
transform: scale(0) rotateZ(180deg);
transition: all 0.4s cubic-bezier(0.54, 0.01, 0, 1.49);
}
input[type="checkbox"]:checked + label::before {
transform: scale(1.0) rotateZ(0deg);
}
label::after {
content: "";
border: 2px solid #27ae60;
width: 24px;
height: 24px;
position: absolute;
left: -42px;
top: 1px;
border-radius: 50%;
}
This is a simple transform and transition where i rotate the img (check-circle.svg) in those 4 curve points of cubic-bezier , whenever it is checked or unchecked after. However the transition and transformation wont work. It will simply not show. Where am i mistaken ?
Are you sure you've placed <label>...</label> immediately after <input type="checkbox"/>? Code seems fine, although I'm not sure what is the purpose of input[type="checkbox"]{ display: none; }. Posting html would be nice too.
Also you can check if provided svg's url is correct. Try to replace it with some other svg url found on internet.
make sure that (label) is a direct next child of (input)

How to add span tag inside Divi Contact Form module submit button

I am building a contact form using the divi builder's module.
Divi's contact form already comes with a button and I need to customize it by adding html span tags within the button tag.
.link--button {
font-family: "Raleway", sans-serif;
font-size: 15px;
line-height: 22.6px;
background-color: transparent;
padding: 16px 32px 16px 40px;
cursor: pointer;
border: 4px solid #000000;
color: #000000;
}
.link--button:hover .arrow {
transition: all 0.4s ease;
width: 35px;
margin-right: 5px;
}
.arrow {
height: 2px;
width: 25px;
position: relative;
display: inline-block;
cursor: pointer;
margin-right: 15px;
margin-bottom: 4px;
background: black;
}
arrow:before {
right: -2px;
bottom: -3px;
transform: rotate(-45deg);
background: black;
}
.arrow:after {
right: -2px;
top: -3px;
transform: rotate(45deg);
background: black;
}
.arrow:before,
.arrow:after {
content: "";
background: black;
position: absolute;
height: 2px;
width: 10px;
border-radius: 30%;
}
<button class="link--button btn--black">
<span class="arrow arrow--black"></span>Submit
</button>
How can I modify divi's html to insert the arrow?
I found the answer. In the Divi Themes integration tab, use jquery to prepend the HTML as so:
jQuery(document).ready(function(){
jQuery(".my-form .et_pb_button").prepend('<span class="arrow arrow--black"></span>');
});
This adds the HTML tag inside of the form's button

How To Add Cursor Pointer To Button Overlay on File Input

https://codepen.io/adambene/pen/xRWrXN
<div class="upload-btn-wrapper">
<button class="btn">Upload a file</button>
<input type="file" name="myfile" />
</div>
.upload-btn-wrapper {
position: relative;
overflow: hidden;
display: inline-block;
cursor: pointer;
}
.btn {
border: 2px solid gray;
color: gray;
background-color: white;
padding: 8px 20px;
border-radius: 8px;
font-size: 20px;
font-weight: bold;
cursor: pointer;
}
.upload-btn-wrapper input[type=file] {
font-size: 100px;
position: absolute;
left: 0;
top: 0;
opacity: 0;
cursor: pointer;
}
In this example, I want to add cursor:pointer css property, which turns the mouse pointer to hand symbol when hovering over it. However, I am not able to achieve the same. I tried adding the property to all three css elements in all combinations, but that does not work.
You could add font-size to your input and it should work. Pay attention to font-size: 20px;
.upload-btn-wrapper input[type=file] {
position: absolute;
left: 0;
top: 0;
opacity: 0;
font-size: 20px;
cursor: pointer;
}

How do i add a Mouse Over Tooltip to the icons in HTML

I have tried to add a mouse over tooltip to the icons, but they disappear anytime i create the Style .ion-android-hand:before {
I believe there is something i am missing, can anyone help me out on this?
.ion-android-hand: {
visibility: visible;
cursor: pointer;
}
.ion-android-hand:before {
content: attr(data-text);
background-color: rgba(0, 0, 0, 0.8);
width: 14%;
left: 70%;
margin-left: 100px;
height: 10%;
color: #fff;
text-align: center;
border-radius: 5px;
display: block;
z-index: 1;
padding: 10px;
font-size: 80%;
font-style: normal;
position: absolute;
margin-top: 35px;
cursor: pointer;
}
<div class="wash-icons">
<i class="ion-android-hand" data-text="Hand free triggering system"></i>
I have tried to add a mouse over tooltip to the icons, but they disappear anytime i create the Style .ion-android-hand:before {
I believe there is something i am missing, can anyone help me out on this?
I dont know if this will help you but it is a start based on what I understood from your problem.
Hover the red square As it is going to be use for phone I recommand using :focus as well as :hover as there is no mouse on phone. Hover do not work correctly on phones
.wash-icons{
width: 20px;
height:20px;
background:red;
}
.wash-icons .ion-android-hand{
visibility: hidden;
}
.wash-icons:hover .ion-android-hand, .wash-icons:focus .ion-android-hand {
visibility: visible;
cursor: pointer;
}
.ion-android-hand:before {
content: attr(data-text);
background-color: rgba(0, 0, 0, 0.8);
/*width: 14%;*/
left: 0%;
margin-left: 20px;
/*height: 10%;*/
color: #fff;
text-align: center;
border-radius: 5px;
display: block;
z-index: 1;
padding: 10px;
font-size: 80%;
font-style: normal;
position: absolute;
margin-top: 35px;
cursor: pointer;
}
<div class="wash-icons">
<i class="ion-android-hand" data-text="Hand free triggering system"></i>
</div>
Edit:
Process of the correction
Set visibility of .ion-android-hand to visibility: hidden; by default
Change the visibility to visibile when hover its parent .wash-icons
So hover parent show your "i"
Please hover green circle to see the tooltip
First set visibility:hidden; to .ion-android-hand
.ion-android-hand{
visibility:hidden;
}
Then :hover the wash-icons to visible (Mobile phone not hover try :focus instead)
.wash-icons:hover .ion-android-hand,
.wash-icons:focus .ion-android-hand{
visibility: visible;
}
Also added some style to wash-icons for green circle.
.wash-icons{
background:#00cc00;
border-radius:30px;
width:60px;
height:60px;
position:relative;
display:flex;
align-items:center;
justify-content:center;
}
.ion-android-hand:before {
content: attr(data-text);
background-color: rgba(0, 0, 0, 0.8);
width: 100px;
left: 0;
height: 50px;
color: #fff;
text-align: center;
border-radius: 5px;
display: block;
z-index: 1;
padding: 10px;
font-size: 80%;
font-style: normal;
position: absolute;
margin-top: 35px;
cursor: pointer;
}
.ion-android-hand{
visibility: hidden;
cursor: pointer;
}
.wash-icons:hover .ion-android-hand,
.wash-icons:focus .ion-android-hand{
visibility: visible;
cursor: pointer;
}
<div class="wash-icons">me
<i class="ion-android-hand" data-text="Hand free triggering system"></i>
</div>
The top of Tooltip added arrow
Demo here
.wash-icons{
background:url(https://i.stack.imgur.com/FnfUn.png);
background-size:contain;
border-radius:50%;
width:40px;
height:40px;
padding:5px;
position:relative;
}
.ion-android-hand:before {
content: attr(data-text);
background-color: rgba(0, 0, 0, 0.8);
width: 200px;
left: 0;
top:calc(100% + 5px);
height: 20px;
color: #fff;
text-align: center;
border-radius: 5px;
display: block;
z-index: 1;
padding: 10px;
font-size: 80%;
font-style: normal;
position: absolute;
cursor: pointer;
}
.ion-android-hand{
visibility: hidden;
cursor: pointer;
}
.wash-icons:hover .ion-android-hand,
.wash-icons:focus .ion-android-hand{
visibility: visible;
cursor: pointer;
}
.ion-android-hand::after {
content: " ";
position: absolute;
top: calc(100% - 5px);
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: transparent transparent rgba(0, 0, 0, 0.8) transparent;
}
<div class="wash-icons">
<i class="ion-android-hand" data-text="This is Toolip for Android icon"></i>
</div>

How can I float dynamic div's next to each other?

I'm creating my own version of Twitter Bootstrap radio buttons purely based on CSS. The visual feedback for selected radio button is based on input[type="radio"]:checked + span.
As the content of my "buttons" can vary, the width is dynamic. This causes problem aligning the button next to each other.
In my JSfiddle I've set fixed width of 50px. Removing this and the buttons are on top of each other.
Can anyone point me in the right direction of how I can accomplish this?
Here is my code:
//HTML
<div class="button-group binary" data-toggle="buttons-radio">
<div class="radio-wrapper">
<input type="radio" class="active" name="status" value="1" />
<span class="background">Yes</span>
</div>
<div class="radio-wrapper">
<input type="radio" class="inactive" name="status" value="0" checked="checked" />
<span class="background">No</span>
</div>
</div>
//CSS
.button-group{
/*display: table;*/
display: block;
}
.radio-wrapper {
/*display: table-cell; */
display: inline-block;
position: relative;
height: 28px;
margin: 0;
width: 50px; /* I want this to be dynamic */
}
.radio-wrapper:first-child .background{
border-right: 0;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
.radio-wrapper:last-child .background{
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
input[type="radio"]{
position: absolute;
display: block;
height: 28px;
width: 100%;
z-index: 200;
cursor: pointer;
opacity: 0;
}
input[type="radio"]:checked + span {
background-color: #63B1DE;
color: #fff;
}
.background {
position: absolute;
z-index: 100;
height: 100%;
padding: 0 5px;
border: solid 1px #87A2B2;
background-color: #fff;
text-align: center;
line-height: 28px;
text-transform: uppercase;
}
If you remove position: absolute from you background class, you will no longer need the width style:
jsFiddle
.button-group{
/*display: table;*/
display: block;
}
.radio-wrapper {
/*display: table-cell; */
display: inline-block;
position: relative;
height: 28px;
margin: 0;
/*width: 50px; not needed*/
}
.radio-wrapper:first-child .background{
border-right: 0;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
.radio-wrapper:last-child .background{
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
input[type="radio"]{
position: absolute;
display: block;
height: 28px;
width: 100%;
z-index: 200;
cursor: pointer;
opacity: 0;
}
input[type="radio"]:checked + span {
background-color: #63B1DE;
color: #fff;
}
.background {
z-index: 100;
height: 100%;
padding: 0 5px;
border: solid 1px #87A2B2;
background-color: #fff;
text-align: center;
line-height: 28px;
text-transform: uppercase;
}
Having a look at your CSS, I think the issue you are having is because you are making the .background position: absolute it is not taking up any space in its parent, so the parent doesn't really have any width, this is why you have to manually set it. Stripping out the absolute positioning for the .background and actually making it an element that takes up space will give the parent a width (which will be based on its content). Now as far as correcting the on top of each other issue, I would think some floating here would work. CSS is here (I also removed some unnecessary rules)
.radio-wrapper {
position: relative;
float:left;
}
.radio-wrapper:first-child .background{
border-right: 0;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
.radio-wrapper:last-child .background{
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
input[type="radio"]{
position: absolute;
display: block;
height: 28px;
width: 100%;
z-index: 200;
cursor: pointer;
opacity: 0;
}
input[type="radio"]:checked + span {
background-color: #63B1DE;
color: #fff;
}
.background {
height: 100%;
padding: .5em;
border: solid 1px #87A2B2;
background-color: #fff;
text-align: center;
line-height: 28px;
text-transform: uppercase;
}
As per example fiddle.
I did add a bit more padding that you had though so please feel free to adjust as required. I also like padding in ems so if your font changes in size the padding is always relative.