CSS gradient issue, only works in Firefox and Safari - linear-gradients

I've made a (very beautiful in my case) half transparent gradient background, but I can only make it working in Firefox and Safari.
Firefox:
linear-gradient(to bottom, #FFFFFF 0%, rgba(0, 0, 0, 0) 500px) repeat fixed 0 0 rgba(0, 0, 0, 0)
The issue now is that in all other browsers IE10, Chrome and Opera, the last rgba(0,0,0,0) overlay seems to be ignored, which causes the gradient kind of shining instead darkened.
Code for the other browsers:
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,1)), color-stop(500px,rgba(0,0,0,0))) repeat fixed 0 0 rgba(0, 0, 0, 0); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(0,0,0,0) 500px) repeat fixed 0 0 rgba(0, 0, 0, 0); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(0,0,0,0) 500px) repeat fixed 0 0 rgba(0, 0, 0, 0); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(0,0,0,0) 500px) repeat fixed 0 0 rgba(0, 0, 0, 0); /* IE10+ */
How can I get this last dark layer for Chrome, Opera and Internet-Explorer 10?
Do you see something wrong? I guess something wrong with the shorthand code or not possible at all?

Related

What is the pixel value for 1 REM (Root Ephemeral Units) for IE edge?

I did some google search, but could not find out what is the default pixel value (1 rem) for edge. If someone could put a link here, that will be appreciated. e.g. xx pixel === 1 rem, for edge.
I haven't found any doc talking about it, but I can give you an answer: 16px === 1rem in Edge (with font size set to "Medium" in Edge settings).
I did a simple test. I set the font-size in CSS to be 1rem, and inspected its pixel value in DevTools. It says 16px. See the pic below:
But if you change the font size inside browser, this equation will break. Simply put,
Very small: 9px === 1rem
Small: 12px === 1rem
Medium: 16px === 1rem
Large: 20px === 1rem
Very large: 24px === 1rem

piechart using svg and react

I created a pie chart in React using the svg pattern from this tutorial https://www.smashingmagazine.com/2015/07/designing-simple-pie-charts-with-css/
With four pieces I have
For all four pieces:
stroke-dasharray: 25, 100;
For each piece I also have:
stroke-dashoffset: 0;,
stroke-dashoffset: -25;,
stroke-dashoffset: -50; and
stroke-dashoffset: -75;
Problem is I get a gap between the first and the last piece so the pieces does not fully fill the circle.
I managed to figure out the answer by looking at this similar thread SVG circle has a gap
It turned out I had a radius of 16 the full circle was more than 100%. Setting stroke-dasharray: 100,53and dividing my radius by 1.0053 helped.

Scaling SVG objects defined in pixels to physical units?

I have an SVG element defined with a width and height of "297mm" and "210mm", and no viewbox. I do this because I want to work inside an A4 viewport, but I want to create elements in pixels.
At some point, I need to scale up an object defined in pixels so that it fits into part of the A4 page. For example, I might have an object which is 100 px wide, that I want to scale to 30mm horizontally.
Is this possible? I think I need a second container with a new co-ordinate system, but I can't find any way to do this.
EDIT
It seems that I (or SVG) has misunderstood what a pixel is. I realised that I could size a line to 100%, and then get it's pixel size with getBBox to find the scaling required. I wrote this code and ran it on 2 clients, one with a 1280x1024 monitor (80dpi), and one with a 1680x1050 LCD (90dpi):
function getDotsPerInch() {
var hgroup, vgroup, hdpi, vdpi;
hgroup = svgDocument.createElementNS(svgNS, "g");
vgroup = svgDocument.createElementNS(svgNS, "g");
svgRoot.appendChild(hgroup);
svgRoot.appendChild(vgroup);
drawLine(hgroup, 0, 100, "100%", 100, "#202020", 1, 1);
drawLine(vgroup, 100, 0, 100, "100%", "#202020", 1, 1);
hdpi = hgroup.getBBox().width * 25.4 / WIDTH;
vdpi = vgroup.getBBox().height * 25.4 / HEIGHT;
drawText(hgroup, "DPI, horizontal: " + hdpi.toFixed(2), 100, 100);
drawText(hgroup, "DPI, vertical: " + vdpi.toFixed(2), 100, 120);
}
IE9, FF, Opera, and Chrome all agree that both monitors are 96 dpi horizontally and vertically (although Opera's slightly inaccurate), and Safari reports 0 dpi on both monitors. So svg just appears to have defined "pixels" as "96dpi". some quick Googling appears to confirm this, though I haven't found anything definitive, and most hits give 90dpi, with 96dpi as the FF variant.
You can nest <svg> elements and use the viewBox attribute on the child element to get a new coordinate system. Give the child <svg> element x, y, width and height attributes of where you want it to appear on the parent in the parent's co-ordinate system.

3 sided box shadow on top of two sided box shadow

I 'm trying to create a two sided box shadow in two seperate elements, sandwiched by a three sided box shadow on the bottom and a three sided box shadow element on top. Like the image below:
I'm close, but as you can see, there is a bit of a space issue between the 3rd and 4th elements, and the top shadow is stopping in the middle for some reason...here is the CSS I have:
#tile1{
-webkit-box-shadow: 7px 0 5px #319a00 , -7px 0 5px #319a00, 0 -2px 5px 5px #319a00;
}
#tile2{
-webkit-box-shadow: 7px 0 5px #319a00 , -7px 0 5px #319a00;
}
#tile3{
-webkit-box-shadow: 7px 0 5px #319a00 , -7px 0 5px #319a00;
}
#tile4{
-webkit-box-shadow: 7px 0 5px #319a00 , -7px 0 5px #319a00, 0 3px 5px 5px #319a00;
}
Any ideas on how to make this happen? I can't just put a box shadow to the whole div because I'm going to have these element toggle.
You CAN put a box-shadow on the whole div even if you're going to toggle those inner elements. All you have to do is put a min-height property (make this equal to the height when all the boxes are toggled off) on your div instead of the height property and it will work.

Why is there a space gap when setting the padding of a Dialog to (0,0,0,0)?

I added a List to a Dialog. I tried all the possibilities :
dialog.getContentPane().getSelectedStyle().setPadding(0, 0, 0, 0);
dialog.getContentPane().getUnselectedStyle().setPadding(0, 0, 0, 0);
dialog.getContentPane().getStyle().setPadding(0, 0, 0, 0);
list.getUnselectedStyle().setPadding(Component.LEFT, 0, false);
list.getSelectedStyle().setPadding(Component.LEFT, 0, false);
list.getStyle().setPadding(Component.LEFT, 0, false);
but there is still a space gap at the left : the colored Label returned from getListFocusComponent of the List renderer doesn't occupy all the Dialog's horizontal space !
So how to make the Label of the getListFocusComponent() occupy all the Dialog's horizontal space : left and right ?
Set the list margin to 0 as well. The best way to see which component is responsible is to assign them a line border so you can see which component contains the padding/margin. Notice that the margin resides outside of that border.

Resources