[英]How to use prefixes for inline styles. React
For example. 例如。
return {
transform: 'rotateY(' + d.rotateY + 'rad) '
+ ' translateX(' + translateX + 'px)'
+ ' translateZ(' + d.translateZ + 'px)'
+ ' rotateY(' + d.rotateYAround + 'deg)',
...
How to use 'ms' prefix ? 如何使用'ms'前缀?
Per the React docs : 根据React文档 :
Vendor prefixes other than ms should begin with a capital letter.
ms以外的供应商前缀应以大写字母开头。 This is why WebkitTransition has an uppercase "W".
这就是WebkitTransition具有大写字母“ W”的原因。
So your inline styles would look like this: 因此,您的内联样式将如下所示:
return { msTransform: 'rotateY(' + d.rotateY + 'rad) ' + ' translateX(' + translateX + 'px)' + ' translateZ(' + d.translateZ + 'px)' + ' rotateY(' + d.rotateYAround + 'deg)', ..., transform: 'rotateY(' + d.rotateY + 'rad) ' + ' translateX(' + translateX + 'px)' + ' translateZ(' + d.translateZ + 'px)' + ' rotateY(' + d.rotateYAround + 'deg)', ... }
Although I would recommend something that adds prefixes automatically. 尽管我建议自动添加前缀的内容。 You might want to look into using a library such as styled-components rather than using inline styles.
您可能要考虑使用诸如样式组件之类的库,而不是使用内联样式。
Per the styled-components docs : 根据样式组件文档 :
The CSS rules are automatically vendor prefixed, so you don't have to think about it.
CSS规则会自动带有供应商前缀,因此您无需考虑。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.