我有这个SVG:
* { background: #e1e1e1; }
<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>
如何旋转180度?!
解决方法
只需使用元素类型选择器并将transform:rotate(180deg)属性添加到它,就像在下面的代码片段中一样.
* { background: #e1e1e1; } svg { transform: rotate(180deg); }
<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>
或者,如果您只想旋转路径而不是svg本身,那么请在下面的代码段中包含transform-origin:
* { background: #e1e1e1; } path { transform: rotate(180deg); transform-origin: 50% 50%; }
<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>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。