Odd Firefox rendering (css transform) - firefox

this new CSS3 stuff is so fancy, but the rendering seems to be really inconsistent among browsers (and I'm not even talking about the shadow shape itself)
Here I made an example that looks fabulous in Chrome, but with a jagged border in Firefox:
http://jsfiddle.net/eBJxV/4/
Note that I've added a box-shadow and it looks like the background color shines through.
For Chrome, there is this workaround with translate3D, is there also something I can do for Firefox?
here's the code you can also see in JSFiddle
h1 {
background-color: #E8501F;
border-radius: 13px 0 0 13px;
box-shadow: 2px 3px 3px rgba(0, 0, 0, 0.3);
display: block;
font-size: 18px;
height: 30px;
letter-spacing: 0.03em;
padding: 0 20px;
text-transform: uppercase;
transform: matrix(0.997564, -0.0697565, 0.0697565, 0.997564, 0, 0);
transform: rotate(-4deg) translate3d( 0, 0, 0);
-webkit-transform: matrix(0.997564, -0.0697565, 0.0697565, 0.997564, 0, 0) translate3d( 0, 0, 0);
-webkit-transform: rotate(-4deg) translate3d( 0, 0, 0);
margin:10px 0;
width:100px;
font-weight:bold;
font-family:Verdana;
color:#ffffff;
}
body{
background-color:#FFF;
}

You can fix it with a CSS filter:
filter: url('data:image/svg+xml;utf8,<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><filter id="gaussian_blur"><feGaussianBlur in="SourceGraphic" stdDeviation="0" /></filter></defs></svg>#gaussian_blur');
Here is the jsfiddle:
http://jsfiddle.net/eBJxV/14/
Note that this info (and more) is convered on a blog post I wrote a while ago on the subject:
http://www.useragentman.com/blog/2014/05/04/fixing-typography-inside-of-2-d-css-transforms/
Hope this helps.

used to this for old Firefox -moz
As like this
h1 {
-moz-transform: matrix(0.997564, -0.0697565, 0.0697565, 0.997564, 0, 0) translate3d( 0, 0, 0);
-moz-transform: rotate(-4deg) translate3d( 0, 0, 0);
}

Solved it, by adding a border with 1px with, and the same background color.
Then apply box-sizing differently, sot that the border is part of the size.
Then due to padding, had to change the width.
http://jsfiddle.net/eBJxV/19/
h1 {
background-color: #E8501F;
border-radius: 13px 0 0 13px;
box-shadow: 2px 3px 3px rgba(0, 0, 0, 0.3);
display: block;
font-size: 18px;
height: 30px;
letter-spacing: 0.03em;
padding: 0 20px;
text-transform: uppercase;
border-style: solid;
border-color: #E8501F;
border-width:1px;
transform: matrix(0.997564, -0.0697565, 0.0697565, 0.997564, 0, 0);
transform: rotate(-4deg) translate3d( 0, 0, 0);
box-sizing: border-box;
outline: 1px solid transparent;
-webkit-transform: matrix(0.997564, -0.0697565, 0.0697565, 0.997564, 0, 0) translate3d( 0, 0, 0);
-webkit-transform: rotate(-4deg) translate3d( 0, 0, 0);
margin:10px 0;
width:140px;
font-weight:bold;
font-family:Verdana;
color:#ffffff;
}
body{
background-color:#FFF;
}
<h1>JSFiddle</h1>
<h1>Shiddle</h1>

Related

Vaadin 8: Customize button color

I want to change the green color from the valo "friendly" button but I failed.
I did as described in
Vaadin Upload Button, CSS to change its color (same styles as Button)?
but I think I missed something.
From the styles.css I copied the
.mytheme .v-button-friendly {
height: 37px;
padding: 0 16px;
color: #eaf4e9;
font-weight: 400;
border-radius: 4px;
border: 1px solid #227719;
border-top-color: #257d1a;
border-bottom-color: #1e6b15;
background-color: #2c9720;
background-image: -webkit-linear-gradient(top, #2f9f22 2%, #26881b 98%);
background-image: linear-gradient(to bottom,#2f9f22 2%, #26881b 98%);
-webkit-box-shadow: inset 0 1px 0 #46b33a, inset 0 -1px 0 #26811b, 0 2px 3px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 0 #46b33a, inset 0 -1px 0 #26811b, 0 2px 3px rgba(0, 0, 0, 0.05);
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05);
}
to the mytheme.scss and just changed the color.
mytheme.scss looks now as follows:
#import "../valo/valo.scss";
#mixin mytheme {
#include valo;
.v-button-sgcgreen {
height: 37px;
padding: 0 16px;
color: #006666;
font-weight: 400;
border-radius: 4px;
border: 1px solid #227719;
border-top-color: #257d1a;
border-bottom-color: #1e6b15;
background-color: #006666;
background-image: -webkit-linear-gradient(top, #2f9f22 2%, #26881b 98%);
background-image: linear-gradient(to bottom,#2f9f22 2%, #26881b 98%);
-webkit-box-shadow: inset 0 1px 0 #46b33a, inset 0 -1px 0 #26811b, 0 2px 3px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 0 #46b33a, inset 0 -1px 0 #26811b, 0 2px 3px rgba(0, 0, 0, 0.05);
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05);
}
}
and it is added to the end of the styles.css file as
.mytheme .v-button-sgcgreen {....}
I set the style for the button as
Button showAllProbesBtn = new Button("Show all");
showAllProbesBtn.addStyleName("sgcgreen");
But the button is default grey and does not have the specified color.
What am I missing?
Thank you for your help!
Edit:
It seems what I did is correct but just not displayed directly. Although I did Maven clean install several times and restarted the Tomcat, the correct color appeared only after I started changing something else in the code.
Where is the style cached? What do I have to do to see style changes immediately in Eclipse and in Chrome?
I recommend that you change the Valo variable v-friendly-color (see Valo theme doc). Example mytheme.scss:
// overwrite Valo variables
$v-friendly-color: #0000F0;
// Import valo after setting the parameters
#import "../valo/valo";
#mixin goidentity {
#include valo;
}
The Valo theme will then take the color you set. No need to mess with CSS styles. However, I don't know if this color variable is used elsewhere in the theme. So this might effect other styles than only the friendly button.

can i attach arrow with the tooltip in d3?

I have my chart fiddle here. I want to make tooltip with an arrow. Can i do that in d3?attached fiddle of graph
css for the tooltip for now-
.hor_tooltip {
position: absolute;
width: 50px;
height: auto;
padding: 10px;
background-color: white;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
-webkit-box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.4);
-moz-box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.4);
box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.4);
pointer-events: none;
display:none
You can add
.hor_tooltip:after {
left: 100%;
top: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-color: rgba(255, 255, 255, 0);
border-left-color: #ffffff;
border-width: 10px;
margin-top: -10px;
}
See https://jsfiddle.net/c74eoo2b/12/

Scss Button Mixin

I've been trying to troubleshoot this for hours but I just don't understand what I'm doing wrong. Maybe it's not me and it's a glitch in codekit? I have built a scss button mixin.
#mixin btn ($background : blue, $textcolor : $white, $size : medium, $fullWidth : false) {
display: inline-block;
width: auto;
border: 0;
border-radius: 4px;
text-align: center;
box-shadow: 0 0 4px rgba(0,0,0,.03), inset 0 1px 2px rgba(102,190,255,.75);
color: $textcolor;
text-decoration: none;
#include font(normal);
#include transition(box-shadow 150ms ease);
&:hover{
box-shadow: 0 0 4px rgba(0,0,0,.03), inset 0 -1px 2px rgba(102,190,255,0.75), inset 0 1px 2px rgba(0,0,0,0.5);
}
&:active{
box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.03), 0px -1px 3px rgba(102, 190, 255, .5) inset, 0px 3px 2px rgba(0, 0, 0, 0.5) inset
}
// Background
#if ($background == 'blue') {
/* #include gradient(#1673b9, #125e97); */
background: blue;
} #else if ($background == 'grey') {
/* #include gradient($grey-light, $grey-dark); */
background: grey;
}
// Sizes
#if $size == small {
}
#if $size == medium {
height: 32px;
line-height: 32px;
padding: 0 18px;
font-size: 14px;
}
#if $size == large {
}
#if $fullWidth == true {
width: 100%;
display: block;
}
}
The sizes and full-size conditionals work just fine. But the Background does not. It just doesn't do anything. For now the Scss that uses it is:
<div id="main-header">
Create New Content
Download CSV
</div>
.btn{
&.create{
#include btn(blue);
}
&.download{
#include btn(grey);
}
}
With that, I should be seeing two different color buttons. The markup and Scss will be improved but this is what it is for testing purposes. It seems to work fine here: http://sassmeister.com/gist/da3707a3e03609f8991c
Any help or suggestions will be greatly appreciated. Thanks!
Oh, as I looked over this question, I noticed I pasted the mixin that has #if ($background == 'blue'){ I have tried that without single quotes and without parentheses.
The condition should be
if($background == blue)
Also you have 2 other mixins inside which you should resolve or remove
#include font(normal);
#include transition(box-shadow 150ms ease);
Here's the whole SCSS file:
$white:white;
#mixin btn ($background : blue, $textcolor : $white, $size : medium, $fullWidth : false)
{
&:hover
{
box-shadow: 0 0 4px rgba(0,0,0,.03), inset 0 -1px 2px rgba(102,190,255,0.75), inset 0 1px 2px rgba(0,0,0,0.5);
}
&:active
{
box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.03), 0px -1px 3px rgba(102, 190, 255, .5) inset, 0px 3px 2px rgba(0, 0, 0, 0.5) inset;
}
// Background
#if ($background == blue)
{
background: blue;
}
#else if ($background == 'grey')
{
background: grey;
}
// Sizes
#if $size == small
{
}
#if $size == medium
{
font-size: 14px;
height: 32px;
line-height: 32px;
padding: 0 18px;
}
#if $size == large
{
}
#if $fullWidth == true
{
display: block;
width: 100%;
}
}
.btn
{
&.create
{
}
&.download
{
}
}
and its generated CSS:
.btn.create
{
background: blue;
border: 0;
border-radius: 4px;
box-shadow: 0 0 4px rgba(0, 0, 0, 0.03), inset 0 1px 2px rgba(102, 190, 255, 0.75);
color: white;
display: inline-block;
font-size: 14px;
height: 32px;
line-height: 32px;
padding: 0 18px;
text-align: center;
text-decoration: none;
width: auto;
}
.btn.create:hover
{
box-shadow: 0 0 4px rgba(0, 0, 0, 0.03), inset 0 -1px 2px rgba(102, 190, 255, 0.75), inset 0 1px 2px rgba(0, 0, 0, 0.5);
}
.btn.create:active
{
box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.03), 0px -1px 3px rgba(102, 190, 255, 0.5) inset, 0px 3px 2px rgba(0, 0, 0, 0.5) inset;
}
.btn.download
{
border: 0;
border-radius: 4px;
box-shadow: 0 0 4px rgba(0, 0, 0, 0.03), inset 0 1px 2px rgba(102, 190, 255, 0.75);
color: white;
display: inline-block;
font-size: 14px;
height: 32px;
line-height: 32px;
padding: 0 18px;
text-align: center;
text-decoration: none;
width: auto;
}
.btn.download:hover
{
box-shadow: 0 0 4px rgba(0, 0, 0, 0.03), inset 0 -1px 2px rgba(102, 190, 255, 0.75), inset 0 1px 2px rgba(0, 0, 0, 0.5);
}
.btn.download:active
{
box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.03), 0px -1px 3px rgba(102, 190, 255, 0.5) inset, 0px 3px 2px rgba(0, 0, 0, 0.5) inset;
}

CSS: How to automatically resize a circular image as a window resizes?

I'm using this CSS to create a circular image 220px wide, centered within its container (a 3-column span of an 1180px grid):
.circular-image {
display: block;
margin: 0 auto;
width: 220px;
height: 220px;
border-radius: 110px;
-webkit-border-radius: 110px;
background: url(images/some-image.png);
box-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
-webkit-box-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
-moz-box-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
}
And I know that you can cause images to automatically rescale using:
img {
height: auto;
}
How do I do this for circular images?
What is the exact problem with circular images? If you have problems with the "roundness" of the image you should change the border-radius property to a relative value:
.circular-image {
display: block;
margin: 0 auto;
width: 75%;
height: auto;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
background-color: red;
}
Here is a working jsFiddle.
border-radius: 50%; will make an element round for what ever size it is (so long as the width and height are the same).

Auto-number pictures

I have an entertainment blog with a lot of pictures. Can someone please help me with a code that auto-numbers the pictures inside a post? (eg: www.chive.com, www.acidcow.com)
This is my CSS for pictures if it helps for anything...
.post-body img, .post-body .tr-caption-container, .Profile img, .Image img,
.BlogList .item-thumbnail img {
padding: $(image.border.small.size);
background: $(image.background.color);
border: 0px solid $(image.border.color);
-webkit-border-radius: 18px;
-moz-border-radius: 18px;
border-radius: 18px;
-moz-box-shadow: 1px 1px 5px rgba(0, 0, 0, .5);
-webkit-box-shadow: 1px 1px 5px rgba(0, 0, 0, .5);
box-shadow: 1px 1px 5px rgba(0, 0, 0, .5);}

Resources