SVG path drawing truncated in Firefox - html
I have used a pure css and svg toggle switch checkbox taken from here and =it worked perfectly on all browsers, until my Firefox was updated to the new Firefox Quantum (version 57.0), in which half of the switch was not drawn. My vectoring skills are admittedly low, I don't know Firefox Quantum well enough and I have no idea what's went wrong with it. Any help would be highly appreciated.
this is how it looks on Chrome and Explorer
and this is on Firefox Quantum
Looks like in Firefox Quantum the path that is being drawn is
<path class='shape' d='M88.256,43.76c12.188,0,21.88-9.796,21.88-21.88S100.247,0,88.256,0c-15.745,0-20.67,12.281-33.257,12.281'></path>
instead of the full path, which is
<path class='shape' d='M88.256,43.76c12.188,0,21.88-9.796,21.88-21.88S100.247,0,88.256,0c-15.745,0-20.67,12.281-33.257,12.281,S38.16,0,21.731,0C9.622,0-0.149,9.796-0.149,21.88s9.672,21.88,21.88,21.88c17.519,0,20.67-13.384,33.263-13.384,S72.784,43.76,88.256,43.76z'></path>
Looks like the browser ignored a big part of the path.
here is codepen and here is the full code:
html:
<div class='checkbox'>
<label class='checkbox__container'>
<input class='checkbox__toggle' type='checkbox'>
<span class='checkbox__checker'></span>
<span class='checkbox__txt-left'>On</span>
<span class='checkbox__txt-right'>Off</span>
<svg class='checkbox__bg' space='preserve' style='enable-background:new 0 0 110 43.76;' version='1.1' viewbox='0 0 110 43.76'>
<path class='shape' d='M88.256,43.76c12.188,0,21.88-9.796,21.88-21.88S100.247,0,88.256,0c-15.745,0-20.67,12.281-33.257,12.281,S38.16,0,21.731,0C9.622,0-0.149,9.796-0.149,21.88s9.672,21.88,21.88,21.88c17.519,0,20.67-13.384,33.263-13.384,S72.784,43.76,88.256,43.76z'></path>
</svg>
</label>
</div>
scss:
.ext-cross{
&:before, &:after{
content:"";
display: block;
position: absolute;
width: 14px;
height: 2px;
margin: 0 auto;
top: 20px;
left: 0;
right: 0;
background-color: #bf1e1e;
border-radius: 5px;
transition-duration: .3s;
}
&:before{
transform: rotateZ(45deg);
}
&:after{
transform: rotateZ(-45deg);
}
}
.ext-ok{
&:before, &:after{
background-color: #0cb018;
}
&:before{
width: 6px;
top: 23px;
left: -7px;
}
&:after{
width: 12px;
left: 5px;
}
}
//checkbox
.checkbox{
width: 100px;
margin: 0 auto 30px auto;
&__container{
display: block;
position: relative;
height: 42px;
cursor: pointer;
}
&__toggle{
display: none;
&:checked + .checkbox__checker{
left: calc(100% - 43px);
transform: rotateZ(360deg);
#extend .ext-ok;
}
}
&__checker, &__cross, &__ok{
display: block;
position: absolute;
height: 43px;
width: 43px;
top: -1px;
left: 0px;
z-index: 1;
#extend .ext-cross;
}
&__checker{
border-radius: 50%;
background-color: #fff;
box-shadow: 0px 2px 6px rgba(0,0,0,.5);
transition: .3s;
z-index: 2;
&:before, &:after{
transition-duration: .3s;
}
}
&__cross, &__ok{
&:before, &:after{
background-color: #ddd;
}
}
&__ok{
#extend .ext-ok;
left: calc(100% - 43px);
}
&__txt-left, &__txt-right{
display: block;
position: absolute;
width: 42px;
top: 15px;
text-align: center;
color: #fff;
font-size: 12px;
z-index: 1;
}
&__txt-right{
right: 0px;
}
&__bg{
position: absolute;
top: 0;
left: 0;
fill: #aaa;
width: 100%;
height: 100%;
}
}
UPDATE
It was not tested on older version of Firefox, that was a mistake.
According to the SVG specification, commas are only valid if a number is either side of them so
12.281,S3
is invalid and the path rendering terminates at the point of invalidity. Remove the invalid comma and the S command will be rendered too.
All versions of Firefox have behaved like this, it's not new with Quantum. If it renders in other browsers, it's those other browers that are buggy, not Firefox.
Related
Custom checkbox, change on :hover and :checked. Doesn't work
I have problem with my custom checkbox. I would like to change color to green on :hover and yellow on checked. I tried almost 10 different ways :/ Someone could help me? Code Pen <body> <div class="container"> <div class="form__checkbox"> <label for="accept" class="form__checkbox-label">I have read and accept the terms of use.</label> <input type="checkbox" id="accept" class="form__checkbox-input"> </div> </body> CSS (SASS): &__checkbox { z-index: 2; position: relative; &-label { cursor: pointer; #include inputFonts(); margin-left: 46px; padding: 0.5rem; font-size: 1.6rem; &::before { content: ""; display: block; position: absolute; left: 2%; top: 50%; transform: translateY(-50%); height: 20px; width: 20px; background-color: blue; margin-right: 20px; } &:hover + &::before { background-color: red; height: 40px; } } &-input { position: absolute; top: -999999px; opacity: 0; } }
The selector &:hover + &::before will not work, because you are selecting the next element's psudo-element(+ &::before). What (I think) you want to do, is to change the current element's psudo-element. I regards to the hover state, you can change this: &:hover + &::before { // compiled to: .form__checkbox-label:hover + .form__checkbox-label::before background-color: red; height: 40px; } to this: &:hover:before { // compiled to: .form__checkbox-label:hover:before background-color: red; height: 40px; } This will make the blue checkbox in your example turn red (with 40 px height) on hover. Changing color based on checkbox state In order to do this, you need to do a couble of things: Rearrange the html <div class="form__checkbox"> <!-- input first! --> <input type="checkbox" id="accept" class="form__checkbox-input"> <label for="accept" class="form__checkbox-label">I have read and accept the terms of use.</label> </div> Add a css selector to your checkbox, targeting the "next sibling label" when :checked. &__checkbox { // abbreviated... &-input { // abbreviated... &:checked + .form__checkbox-label:before { background-color: green; } } }
I back to this code, and now I have problem with change checked button. I would like to add grey background and show "checked bird". I tried various methods and it doesn't work.. Again Link https://codepen.io/direct96/pen/eLXMXY &__checkbox { z-index: 2; position: relative; &-label { cursor: pointer; #include inputFonts(); margin-left: 46px; padding: 0.5rem; font-size: 1.6rem; &::before { content: ""; display: block; position: absolute; left: 15px; margin-right: 50px; top: 50%; transform: translateY(-50%); height: 23px; width: 23px; background-color: $form-text-color; } &::after { content: ""; position: absolute; display: none; left: 4.5%; top: 45%; background: white; width: 2.5px; height: 2.5px; box-shadow: 2px 0 0 white, 4px 0 0 white, 4px -2px 0 white, 4px -4px 0 white, 4px -6px 0 white, 4px -8px 0 white; transform: rotate(45deg); } &:hover::before { background-color: $color-input-focus; } }
Why doesn't the css `rotateY` property work on safari
Below is my html and css code. It is pretty simple. I want to show a square \F1FC on a red react. .parent::before { position: absolute; content: ''; width: 40px; height: 40px; background-color: red; border-radius: 10px 0px 0px 10px; transform: perspective(5px) rotateY(-2deg); z-index: -1; } p::before { content: "\F1FC"; color: black; margin-left: 15px; } <div class="parent"> <p></p> </div> This code works fine on chrome but doesn't work on safari. Half of the square is hidden by the p::before. Below is a screen shot on safari: Below is the screenshot for chrome:
This is some kind of weird bug in Safari and pseudo elements. My solution for this issue was to counter the transform: rotateY(-2deg); on the parent pseudo element since it was causing the issue. Add display: block; and transform: rotateY(1deg); to p::before. The small rotation doesn't seem to affect how the square looks and it fixes it for me in Safari. .parent::before { position: absolute; content: ''; width: 40px; height: 40px; background-color: red; border-radius: 10px 0px 0px 10px; transform: perspective(5px) rotateY(-2deg); z-index: -1; } p::before { content: "\F1FC"; color: black; display: block; margin-left: 15px; transform: rotateY(1deg); } <div class="parent"> <p></p> </div>
HTML Button not clickable in IE
I have a button with the text "Description" that in IE is not clickable. Well, actually the far right edge of it is clickable, but not the whole button and text content of the button. It works fine in modern browsers (Chrome, Firefox), but not in IE. I am using IE 11 for testing. What is causing this and how do I fix it? I've tried to strip out as much as possible... .vertical-button { width: 1px; height: 20px; background: #000; position: absolute; right: -68px; top: calc(50% - 10px); display: flex; flex-direction: column; justify-content: center; opacity: 0; -webkit-transition: 0.8s; -moz-transition: 0.8s; -ms-transition: 0.8s; -o-transition: 0.8s; transition: 0.8s; } .vertical-button { right: -100px; } .project--active .vertical-button { opacity: 1; } .project__image, .project__text { position: relative; width: 100%; max-width: 408px; margin: 20px auto; margin-bottom: 0px; } .project__text { height: 200px; padding: 8px; } .project__image, .project__text { width: 280px; height: 210px; display: inline-block; margin: 0 auto; } .project__text { padding-top: 20px; padding-left: 20px; } .project { -webkit-column-count: 2; -moz-column-count: 2; column-count: 2; padding: 18px; margin: 30px auto; width: 614px; height: 246px; box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.3); } .project { padding: 20px; width: 740px; height: 295px; } .l-wrapper { position: relative; width: 86%; max-width: 1024px; margin: 0 auto; } .l-wrapper { width: 80%; } .l-clear::after, .l-wrapper::after { clear: both; content: ""; display: block; height: 0px; visibility: hidden; } .l-section { padding: 30px 0; } .l-section__bg { background-color: #F2F2F2; } .l-container { position: relative; padding-bottom: 50px; overflow: hidden; background-color: #FFFFFF; z-index: 99; } .vertical-button__btn, .vertical-button__btn:focus, .vertical-button__btn:active { background: none; border: none; display: inline; font: inherit; margin: 0; padding: 0; outline: none; outline-offset: 0; position: absolute; top: 0px; transform-origin: left top; transform: rotate(90deg) translateX(-32%); float: right; padding: 5px; cursor: pointer; cursor: hand; } .vertical-button__stroke { width: 1000px; height: 1px; background: #000; } <div id="app"> <div data-reactroot=""> <div class="l-container"> <div class="l-section l-section__bg"> <div class="l-wrapper"> <div class="project project--active"> <div class="project__image"></div> <div class="project__text"> <h3 class="project__heading">Title</h3> <div class="vertical-button"> <button class="vertical-button__btn">Description</button> <div class="vertical-button__stroke"></div> </div> </div> </div> </div> </div> </div> </div> </div> Edit I have found that if I remove this piece of HTML the button becomes clickable... <div class="project__image"></div> But this still doesn't help me understand why it's happening or how to fix it! I cannot actually remove that div in the real project.
I don't have IE to test, but I can tell you some ideas from my experience. 1. Check if another element is overlapping your button. Being IE, it may handle CSS differently, hence overlapping. Since removing that image class div resolves the problem, I'd guess this would be the cause of the problem. 2. Validate the HTML. Forgetting to close tags can create very, very bizarre bugs, also difficult to find. 3. Try turning that button into an anchor <a> There could be browsers who won't handle the click event properly. 4. Stop using IE :) At least use Edge.
CSS trapezoid shape clickable area issue in chrome browser
I'm trying to get a trapezoidal perspective shape to have the whole area be clickable. I've gotten it to work in Firefox and even IE, but Chrome isn't cooperating too well. Here's a fiddle with the shape and a link: http://jsfiddle.net/9n9uh6f6/1/ As you can tell, the link doesn't become active until you hover over the 'area' part of the text. In other browsers, the whole height of the shape is clickable. I read that Chrome renders a perspective image differently and perhaps that's why it's not doing what it's supposed to. Here's my CSS: .prodcaptions { width:136px; height: 85px; position:relative; left:10%; text-transform:uppercase; text-align:center; letter-spacing: 1.6px; color: #000; } .prodcaptions:before { content:""; position:absolute; border-radius:1px; box-shadow:0 0 0 3px #27628e; top:-5%; bottom:-11%; left:-1%; right:-5%; -webkit-transform:perspective(40em) rotateX(-45deg); transform:perspective(40em) rotateX(-45deg); } .prodcaptions a { z-index:999; position:relative; height: 85px; display: block; padding-top: 25px; }
Please have look at this code: .prodcaptions { position: relative; height: 150px; width: 150px; margin: 50px; padding: 10px; perspective: 150px; perspective-origin: 50% 0; } a{ padding: 50px; position: absolute; border: 1px solid black; transform: rotateX(-15deg); } Seems to work the way you want it. fiddle
Try this shape for link trapazoid shape - jsFiddle Advantage - you can change skew property to change angle of shape! Easy and effective! Reverse value for reverse shape! html Click Here! css a { display: block; z-index: 1; position: relative; /* custom sizes */ width: 136px; height: 85px; /* demo-only decoration */ margin: 100px auto; font: 16px/50px Arial, sans-serif; text-transform: uppercase; text-align: center; background-color: orange; } a:before, a:after { content:''; position: absolute; top: 0; left: 0; width: 100%; bottom: 0; z-index: -1; /* demo-only decoration */ border-radius: 4px; background-color: orange; } a:before { transform: skew(-20deg); left: 25px; } a:after { transform: skew(20deg); right: 25px; left: auto; }
Css Triangle not rendering properly in IE
I am trying to create a css trianlge for the header navigation.I have achieved it but it is not rendering properly in IE. Here is the Working Fiddle solution for the sample i have created.I have fixed the position but when i try to run in IE(Currently i have IE 11.0) the triangle is rendered as a square box but when i try to run it in Chrome and FF it is working fine. Fiddler : http://jsfiddle.net/cKnyQ/20/ a:hover:after { background: white; border: solid black; border-width: 1px 1px 0 0; bottom: 0px; content: ' '; display: block; height: 10px; left: 32px; position: absolute; width: 10px; z-index: 99; -webkit-transform: rotate(-45deg); -webkit-transform-origin: 50% 50%; }
Use -ms-transform: rotate(-45deg)
Thanks Akshay mohite. As a side note i have edited the js fiddle with the searched solution. Fiddle : http://jsfiddle.net/cKnyQ/25/ #Container a:hover::after { content: ""; display: block; border: 8px solid black; border-bottom-color: white; position: absolute; bottom: 0px; left: 50%; margin-left: -12px; background: white; }