Rotate SVG path using CSS

NewCod3r

I have this 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>

How to rotate it by 180 degree?!

DEMO

Harry

Just use the element type selector and add the transform: rotate(180deg) property to it like in the below snippet.

* {
  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>


Or, if you want to rotate only the path and not the svg itself, then include a transform-origin like in the below snippet:

* {
  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>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

SVG rotate path

From Dev

Using CSS to animate the fill of SVG path elements

From Dev

Animate fill of path element in SVG using css

From Dev

CSS clip-path using an entire SVG

From Java

Using CSS to transition the fill property of an SVG path on hover

From Dev

In CSS/SVG, how to rotate each character of a word?

From Dev

CSS transform to rotate an element in an oval path

From Dev

How to rotate text using CSS

From Dev

Rotate right border using css

From Dev

How to rotate a "+" to an "x" using CSS?

From Dev

Get New path after applying the translate rotate and scale on arc SVG

From Dev

Rotate SVG via CSS3 anchor not in the middle

From Dev

Rotate (svg, css) around an arbitrary point, without transform-origin

From Dev

Rotate (svg, css) around an arbitrary point, without transform-origin

From Dev

Using CSS3 attr() with transform rotate

From Dev

Is it possible to rotate text using CSS 2.1?

From Dev

Rotate objects around circle using CSS?

From Dev

Rotate a video and fit to screen using CSS

From Dev

How to rotate a picture using css and javascript

From Dev

css, using rotate and jquery to initial position

From Dev

using css rotate with HTML absolute position

From Dev

Using CSS3 attr() with transform rotate

From Dev

Rotate dot around globe using CSS animation

From Dev

Rotate , Flip Image using Jquery , css

From Dev

Webpack not finding path of SVG CSS backgrounds

From Dev

CSS - Change Fill Color on Hover - SVG PATH

From Dev

Dynamic CSS selection within a group, SVG, Path

From Dev

Animating SVG path with CSS in IE11

From Dev

Rotate SVG symbol to match aircraft heading using Google Maps API

Related Related

HotTag

Archive