旋转svg填充路径框

时间:2015-09-19 09:20:48

标签: html css svg

我使用svg设计框边框,如下所示:

HTML:

<svg class="decor" height="100%" preserveaspectratio="none" version="1.1" viewbox="0 0 100 100" width="100%" xmlns="http://www.w3.org/2000/svg">
    <path d="M0 0 L100 100 L0 100" stroke-width="0"></path>
</svg>

CSS:

.decor {
  fill: #F00;
  stroke: #e74c3c;
}

结果:

enter image description here

现在我需要轮换到这个:

enter image description here

如何生成这个?!

DEMO FIDDLE

2 个答案:

答案 0 :(得分:2)

这样做:

.decor {
  fill: #F00;
  stroke: #e74c3c;
  -webkit-transform: rotate(180deg);
  transform: rotate(180deg);
}

这会将其旋转为您想要的方式。

小提琴:http://jsfiddle.net/jkvp1x8m/

答案 1 :(得分:2)

添加变换=&#34;旋转(180,50,50)&#34;到路径

&#13;
&#13;
.decor {
  fill: #F00;
  stroke: #e74c3c;
}
&#13;
<svg class="decor" height="100%" viewBox="0 0 100 100" width="100%" preserveAspectRatio="none" >
    <path transform="rotate(180, 50, 50)" d="M0 0 L100 100 L0 100"></path>
</svg>
&#13;
&#13;
&#13;