简体   繁体   English

使用CSS编辑生成的SVG属性可在Firefox中运行,但不能在Chrome中运行

[英]Editing generated SVG properties with CSS works in Firefox but not Chrome

I'm using an API that automatically generates a legend based on my map however the legend doesn't format properly. 我使用的API会根据我的地图自动生成图例,但是图例的格式不正确。 I found out that the SVG that gets created returns a transform :matrix value of 我发现创建的SVG返回一个transform:matrix值

transform: matrix(1.00000000,0.00000000,0.00000000,1.00000000,62.50000000,62.50000000) 转换:矩阵(1.00000000,0.00000000,0.00000000,1.00000000,62.50000000,62.50000000)

But what I want is it to return a value of 但是我想要返回的值是

transform: matrix(1.00000000,0.00000000,0.00000000,1.00000000,15.00000000,15.00000000) 转换:矩阵(1.00000000,0.00000000,0.00000000,1.00000000,15.00000000,15.00000000)

I managed to get this to work in Firefox by using this as my CSS 通过将其用作CSS,我设法使它在Firefox中工作

.esriLegendLayer svg :nth-child(2){
display: inline-block;
overflow: hidden;
background: white;
max-height: 30px;
max-width: 30px;
-webkit-transform: matrix(1.00000000,0.00000000,0.00000000,1.00000000,15.00000000,15.00000000) !important;
-moz-transform: matrix(1.00000000,0.00000000,0.00000000,1.00000000,15.00000000,15.00000000) !important;
-o-transform: matrix(1.00000000,0.00000000,0.00000000,1.00000000,15.00000000,15.00000000) !important;
transform: matrix(1.00000000,0.00000000,0.00000000,1.00000000,15.00000000,15.00000000) !important;
}

When the SVG gets created it forces it's transform: matrix value to the one listed in my CSS. 创建SVG时,它会强制进行以下转换:将矩阵值转换为CSS中列出的值。 However when I try it in Chrome it completely ignores the CSS and sticks with the default 但是,当我在Chrome中尝试时,它会完全忽略CSS并坚持使用默认设置

transform: matrix(1.00000000,0.00000000,0.00000000,1.00000000,62.50000000,62.50000000) 转换:矩阵(1.00000000,0.00000000,0.00000000,1.00000000,62.50000000,62.50000000)

How can I get this to work in chrome? 如何在Chrome中使用它?

Thanks but I quickly found the solution was that in chrome there was an additional div element that needed to be styled as well as the SVG. 谢谢,但是我很快发现解决方案是在chrome中,还有一个需要样式化的div元素以及SVG。 The transform matrix method worked I just wasn't aware. 我只是不知道转换矩阵方法的工作原理。

Firefox transform is wrong last two digit must be in px. Firefox转换错误,最后两位必须以px为单位。 And for chrome use this transform: matrix(0.9, -0.05, -0.375, 1.375, 220, 20); 对于chrome,请使用以下转换:matrix(0.9,-0.05,-0.375,1.375,220,20); transform-origin: 0 0; transform-origin:0 0;

Here is the lunk for more info http://www.useragentman.com/blog/2011/01/07/css3-matrix-transform-for-the-mathematically-challenged/ 这是有关更多信息的问题, http: //www.useragentman.com/blog/2011/01/07/css3-matrix-transform-for-the-mathematically-challenged/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM