css - 如何在CSS中垂直翻转铁图标

标签 css polymer iron

我正在为我的 Polymer 2 应用程序使用 iron-icon 组件,我想知道如何垂直或水平翻转这些图标?我已经尝试过 transform 属性和其他浏览器的等效属性,但它对我不起作用。如下:

.my-icon-class {
    color: #55555A;
    margin-top: 10px;
    width: 30px;
    height: 50px;
    transform: scale(-1);
}

我什至在 IE 上试过“过滤器”属性:

.my-icon-class {
    color: #55555A;
    margin-top: 10px;
    width: 30px;
    height: 50px;
    filter: FLipH;
}

我的图标实例化如下:

<iron-icon class="my-icon-class" icon="icons:room"></iron-icon>

导入语句是这样的:

<link rel="import" href="../../bower_components/polymer/polymer-element.html">

<link rel="import" href="../../bower_components/iron-icon/iron-icon.html">
<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">

您可以在下面找到一个片段:

// Load webcomponents.js polyfill if browser doesn't support native Web Components.
var webComponentsSupported = (
  'registerElement' in document
  && 'import' in document.createElement('link')
  && 'content' in document.createElement('template')
);

if (webComponentsSupported) {
	// For native Imports, manually fire WebComponentsReady so user code
  // can use the same code path for native and polyfill'd imports.
  if (!window.HTMLImports) {
    document.dispatchEvent(
      new CustomEvent('WebComponentsReady', {bubbles: true})
    );
  }
} else {
	// Load webcomponents.js polyfill
  var script = document.createElement('script');
  script.async = true;
  script.src = 'https://cdn.rawgit.com/StartPolymer/cdn/1.8.1/components/webcomponentsjs/webcomponents-lite.min.js';
  document.head.appendChild(script);
}
h1 {
  font-size: 24px;
  font-weight: 500;
  line-height: 32px;
  margin: 24px 0;
}

.my-icon-class {
  color: #55555A;
  margin-top: 10px;
  width: 50px;
  height: 70px;
}
<!-- <base href="https://gitcdn.xyz/cdn/StartPolymer/cdn/v1.11.0/components/"> -->
<!-- <base href="https://cdn.rawgit.com/StartPolymer/cdn/v1.11.0/components/"> -->
<base href="https://rawcdn.githack.com/StartPolymer/cdn/v1.11.0/components/">

<link rel="import" href="iron-icon/iron-icon.html">
<link rel="import" href="iron-icons/iron-icons.html">

<style is="custom-style">

body {
  @apply(--layout-vertical);
  @apply(--layout-center-center);
}
</style>

<h1>Polymer Icon to Flip</h1>
<p>And I want to flip it vertically and/or horizontally, need only the css. Thanks</p>

<iron-icon class="my-icon-class" icon="icons:room"></iron-icon>
icon to flip

<script>

window.addEventListener('WebComponentsReady', function() {
  // Async call needed here for IE11 compatibility.
  Polymer.Base.async(function() {
    
  });
});

</script>

如果需要更多信息,请在评论中询问。

最佳答案

我找到了一个解决方案:

.my-class {
    transform: rotate(180deg);
}

关于css - 如何在CSS中垂直翻转铁图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54240079/

相关文章:

html - 用 &lt;!-- ---> 分隔行内 block

将所有内容设置为默认值的 CSS 重置

html - 在 URL 中强制换行

jQuery 覆盖默认验证错误消息显示 (Css) Popup/Tooltip like

javascript - 如何在不使用 ID 的情况下在 Polymer 中选择节点?

javascript - Polymer CLI 和要求

laravel - IronMq + Laravel4 : How make it working

mongodb - 无法在路由器声明中通过闭包传递 Iron 处理程序

javascript - polymer 纸按钮语法错误函数语句需要名称

rust - 如何在 Iron 中使用服务器发送的事件?