{"id":17015,"date":"2017-08-30T11:30:43","date_gmt":"2017-08-30T11:30:43","guid":{"rendered":"https:\/\/www.heartinternet.uk\/blog\/?p=17015"},"modified":"2017-08-30T11:30:43","modified_gmt":"2017-08-30T11:30:43","slug":"discover-the-power-of-css-transforms","status":"publish","type":"post","link":"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/","title":{"rendered":"Discover the Power of CSS Transforms"},"content":{"rendered":"<p>With a single line of CSS we can completely reorient any element on our page &#8211; we can move it, rotate it, resize it, or send it into another dimension (to an extent). This all comes to us via the transform property. While it is a single property, a lot of functionality is packed into it, and it can be confusing how all its values combine to create its end result. Let&#8217;s discuss some of the basics and then dive into a handful of use cases.<\/p>\n<h3>What can transform do?<\/h3>\n<p>The value for the property consists of one or more transformation functions that build on one another.<\/p>\n<h4>The translate Function<\/h4>\n<p>The most straightforward one to jump into is the <code>translate()<\/code> function since it is related to positioning and uses the length units you find in more common properties like <code>margin<\/code> and <code>top<\/code>.<\/p>\n<p><code>.my-element {<br \/>\ntransform: translate(5px, 10%);<br \/>\n}<\/code><\/p>\n<p>Here our CSS will take the element as it is and shift it to the right 5px and down 10% of its size.   The important piece to note is that before the transformation is applied the box is rendered according to the normal layout flow. Visually the element is moved to its new position, but it does not affect the flow of elements that appear later.<\/p>\n<p data-height=\"254\" data-theme-id=\"0\" data-slug-hash=\"NvdNQx\" data-default-tab=\"css,result\" data-user=\"danwilson\" data-embed-version=\"2\" data-pen-title=\"Transforms and Flow\" data-editable=\"true\" class=\"codepen\">See the Pen <a href=\"https:\/\/codepen.io\/danwilson\/pen\/NvdNQx\/\">Transforms and Flow<\/a> by Dan Wilson (<a href=\"https:\/\/codepen.io\/danwilson\">@danwilson<\/a>) on <a href=\"https:\/\/codepen.io\">CodePen<\/a>.<\/p>\n<p><script async src=\"https:\/\/production-assets.codepen.io\/assets\/embed\/ei.js\"><\/script><\/p>\n<p>Elements that appear inside will move with its parent, and you can have nested transforms too.<\/p>\n<p><code>&lt;div style=\"transform: translate(5px, 0)\"&gt;<br \/>\n&lt;div style=\"transform: translate(10px, 0)\"&gt;Hello&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<\/code><\/p>\n<p>With this HTML, the inner div will appear 15px to the right of where its default position was.<\/p>\n<p>You can use the functions <code>translateX()<\/code> and <code>translateY()<\/code> as well if you want to separate them out or only use one direction.<\/p>\n<h4>The scale Function<\/h4>\n<p>You can also make your elements bigger or smaller with the <code>scale()<\/code> function. It accepts a single number, where <code>scale(1)<\/code> represents no change. A number between 0 and 1 will be a fraction of the original size, and a larger number will be bigger than the default size.<\/p>\n<p><code>transform: scale(1); \/\/original size<br \/>\ntransform: scale(2); \/\/twice as big<br \/>\ntransform: scale(0.5); \/\/half size<\/code><\/p>\n<p>You can also scale horizontally to stretch your element with <code>scaleX()<\/code> or vertically with <code>scaleY()<\/code>. Extra fun comes when you start throwing in negative numbers to get flips.<\/p>\n<p data-height=\"268\" data-theme-id=\"0\" data-slug-hash=\"LjxZpX\" data-default-tab=\"css,result\" data-user=\"danwilson\" data-embed-version=\"2\" data-pen-title=\"Scale Options\" data-editable=\"true\" class=\"codepen\">See the Pen <a href=\"https:\/\/codepen.io\/danwilson\/pen\/LjxZpX\/\">Scale Options<\/a> by Dan Wilson (<a href=\"https:\/\/codepen.io\/danwilson\">@danwilson<\/a>) on <a href=\"https:\/\/codepen.io\">CodePen<\/a>.<\/p>\n<p><script async src=\"https:\/\/production-assets.codepen.io\/assets\/embed\/ei.js\"><\/script><\/p>\n<h4>The rotate Function<\/h4>\n<p>Then there are rotations using angle units such as <code>deg<\/code>, <code>rad<\/code>, or <code>turn<\/code>. These all move in the clockwise direction for positive values and counterclockwise for negative values.<\/p>\n<p data-height=\"258\" data-theme-id=\"0\" data-slug-hash=\"XdvVpV\" data-default-tab=\"css,result\" data-user=\"danwilson\" data-embed-version=\"2\" data-pen-title=\"Rotation Options\" data-editable=\"true\" class=\"codepen\">See the Pen <a href=\"https:\/\/codepen.io\/danwilson\/pen\/XdvVpV\/\">Rotation Options<\/a> by Dan Wilson (<a href=\"https:\/\/codepen.io\/danwilson\">@danwilson<\/a>) on <a href=\"https:\/\/codepen.io\">CodePen<\/a>.<\/p>\n<p><script async src=\"https:\/\/production-assets.codepen.io\/assets\/embed\/ei.js\"><\/script><\/p>\n<h4>The skew Function<\/h4>\n<p>There are even ways to skew an element. This uses a similar angle unit to the rotations inside the functions <code>skewX()<\/code> and <code>skewY()<\/code>.<\/p>\n<p data-height=\"265\" data-theme-id=\"0\" data-slug-hash=\"KvXpZo\" data-default-tab=\"css,result\" data-user=\"danwilson\" data-embed-version=\"2\" data-pen-title=\"SkewX\/Y Options\" data-editable=\"true\" class=\"codepen\">See the Pen <a href=\"https:\/\/codepen.io\/danwilson\/pen\/KvXpZo\/\">SkewX\/Y Options<\/a> by Dan Wilson (<a href=\"https:\/\/codepen.io\/danwilson\">@danwilson<\/a>) on <a href=\"https:\/\/codepen.io\">CodePen<\/a>.<\/p>\n<p><script async src=\"https:\/\/production-assets.codepen.io\/assets\/embed\/ei.js\"><\/script><\/p>\n<p>Once you have a handle on these key functions you can explore the 3D equivalents (such as <code>translate3d()<\/code>)and perspective to get a level of depth. But there is plenty to dig into with just the 2D world.<\/p>\n<h3>Building out the full transform<\/h3>\n<p>The transform property does a lot already, but we have only focused on how to apply a single transformation. The property accepts multiple functions at a time, so you can apply both a scale and a rotation with <code>transform: scale(2) rotate(20deg)<\/code>.  You can even use the same functions multiple times, such as with <code>transform: translateX(20px) rotate(.25turn) translateX(30px)<\/code>.<\/p>\n<p>This structure grants us a fair amount of flexibility, but one of the first thoughts people often have is why do we cram everything in one property instead of having separate properties. The primary answer is that all of these transform functions boil down to matrix multiplication (a key piece of Linear Algebra and common in computer graphics). Order can affect the end visual result, so it makes sense to keep them inside the same property. If you check the browser&#8217;s current value of your transform through the JavaScript <code>getComputedStyle(yourElement)<\/code> it will be converted to a <code>matrix()<\/code> function (which is another function you can use if you are comfortable with matrices and how to work with them).<\/p>\n<p data-height=\"248\" data-theme-id=\"0\" data-slug-hash=\"jLmPvj\" data-default-tab=\"css,result\" data-user=\"danwilson\" data-embed-version=\"2\" data-pen-title=\"Order of Transforms\" data-editable=\"true\" class=\"codepen\">See the Pen <a href=\"https:\/\/codepen.io\/danwilson\/pen\/jLmPvj\/\">Order of Transforms<\/a> by Dan Wilson (<a href=\"https:\/\/codepen.io\/danwilson\">@danwilson<\/a>) on <a href=\"https:\/\/codepen.io\">CodePen<\/a>.<\/p>\n<p><script async src=\"https:\/\/production-assets.codepen.io\/assets\/embed\/ei.js\"><\/script><\/p>\n<p>All of this being said, individual properties are in the pipeline and will provide a convenience when you only need to set one. They will follow a predefined order, though, so you lose some flexibility. When this spec is finalised and lands in browsers we will be able to break out simple transforms like this:<\/p>\n<p><code>.element {<br \/>\n  scale: 2;<br \/>\n  rotate: 20deg;<br \/>\n}<\/code><\/p>\n<h3>Why use transform?<\/h3>\n<p>When we can already position and size items many other ways in CSS, why do we even need transforms as web developers? There are a few reasons, but the biggest is the ability to combine them effectively with transitions and animations.<\/p>\n<p>The transforms spec first appeared in the age of the smartphone as users became used to views sliding in and other small transitions. Moving an element from one position to another had long been possible by using JavaScript and modifying the margin property or left and top repeatedly. It even became abstracted out and popularised in jQuery with the <code>animate()<\/code> method. But it was never guaranteed to be smooth and caused repainting and reflow as the styles and layout for the page need to be recalculated.<\/p>\n<p>With transforms the original position stays the same, so the browser can optimise the animation as it doesn&#8217;t have to do the full recalculation. The transformed element moves in its own compositor layer that the browser can effectively treat separately. Combined with a CSS transition that specifies a duration for a transform (e.g. <code>transition: transform 400ms<\/code>) we can animate the element when we have a hover or we toggle a class via JavaScript:<\/p>\n<p><code>a {<br \/>\n  display: inline-block;<br \/>\n  transition: transform 250ms;<br \/>\n}<br \/>\na:hover {<br \/>\n  transform: translateY(10px);<br \/>\n}<br \/>\na.important {<br \/>\n  transform: scale(1.2);<br \/>\n}<\/code><\/p>\n<p>Now anytime the user hovers over a link, it will move down 10px over the course of 250 milliseconds. When we modify the class in JavaScript to include &#8220;important&#8221; we will see the link scale to 120% of its original size, also over the course of 250 milliseconds.<\/p>\n<p>What happens when we hover over a link that has the &#8220;important&#8221; class? You might expect (or at least hope) that it will take the scaled up link and also move it down the 10px. But in fact there is no translation. The values inside the transform are not being appended to previous values, they are simply overriding them. Since the <code>a.important<\/code> rule comes last (and it has the same specificity as the <code>a:hover<\/code> rule) the &#8220;important&#8221; transform is the value used in this case.<\/p>\n<p>In order to have the scaled up link also go down 10px on hover, your styles would need to be updated with:<\/p>\n<p><code>a {<br \/>\n  display: inline-block;<br \/>\n  transition: transform 250ms;<br \/>\n}<br \/>\na:hover {<br \/>\n  transform: translateY(10px);<br \/>\n}<br \/>\na.important {<br \/>\n  transform: scale(1.2);<br \/>\n}<br \/>\na.important:hover {<br \/>\n  transform: scale(1.2) translateY(10px);<br \/>\n}<\/code><\/p>\n<p>This can get unwieldy pretty quickly if you have several variations and you want there to be any combination of them. This is where the upcoming addition to CSS transforms that includes the option to use individual properties (mentioned earlier) will simplify our code. However, this is a future thing, so we currently need to be explicit for every combination of transforms we expect.<\/p>\n<p>Though, to be fair\u2026 that&#8217;s not entirely true if you want to venture into another newer feature of CSS with a lot of exciting possibilities and now in Firefox, Chrome, Safari, and Edge &#8211; CSS Variables! With the help of CSS Variables you can get the best of both worlds by specifying the transform order you want as well as <a href=\"https:\/\/danielcwilson.com\/blog\/2017\/02\/individual-transforms\/\" target=\"_blank\" rel=\"nofollow\">break out properties more individually<\/a>. This is beyond the scope of our current discussion, but it shows the evolving nature of transforms in the larger context of CSS.<\/p>\n<p>In addition to using CSS transitions, we can also get smooth motion with transforms when used with CSS animations. Where transitions give you a straightforward mechanism to animate from a start state to an end state, animations allow you to get more complex. It takes two parts to do a CSS animation: an <code>animation<\/code> property on the element you want to animate and a <code>@keyframes<\/code> definition to specify what happens.<\/p>\n<p><code>div.mover {<br \/>\n  animation: my-fancy-custom-animation 5000ms;<br \/>\n}<br \/>\n@keyframes my-fancy-custom-animation {<br \/>\n  0% {<br \/>\n    transform: translate(0px);<br \/>\n  }<br \/>\n  20% {<br \/>\n    transform: scale(.5);<br \/>\n  }<br \/>\n  50% {<br \/>\n    transform: rotate(120deg);<br \/>\n  }<br \/>\n  80% {<br \/>\n    transform: translateX(80px) rotate(120deg)<br \/>\n  }<br \/>\n  100% {<br \/>\n    transform: translateX(0px);<br \/>\n  }<br \/>\n}<\/code><\/p>\n<p>There are many more options for the animation (related to delays, easing, iteration count, and more), but this shows a minimum amount to get an animation going where we specify the element to have an animation named <code>my-fancy-custom-animation<\/code> and a duration of 5000ms.  We then define what this animation does by setting up a <code>@keyframes<\/code> ruleset. Here we state what should happen at the start, 20% mark, 50% mark, 80% mark, and end. The browser determines what happens in between, so from 0% to 20% it will animate from translate(0) (which would be no transform visually applied) to a scale of .5. Between 20% and 50% it transitions from that half scale to a 120deg rotation, and so forth.<\/p>\n<p>It is important to note the same overriding behaviour applies in these <code>@keyframes<\/code>. When we go from just a scale to just a rotate we are effectively telling the browser to go from  <code>transform: scale(.5) rotate(0deg)<\/code> to <code>transform: scale(1) rotate(120deg)<\/code> (since <code>0deg<\/code> and <code>1<\/code> are the default values for <code>rotate<\/code> and <code>scale<\/code>, respectively).<\/p>\n<p data-height=\"265\" data-theme-id=\"0\" data-slug-hash=\"8e6d3fc608c515ed94c4698a900f871c\" data-default-tab=\"css,result\" data-user=\"danwilson\" data-embed-version=\"2\" data-pen-title=\"Transform animation example\" data-editable=\"true\" class=\"codepen\">See the Pen <a href=\"https:\/\/codepen.io\/danwilson\/pen\/8e6d3fc608c515ed94c4698a900f871c\/\">Transform animation example<\/a> by Dan Wilson (<a href=\"https:\/\/codepen.io\/danwilson\">@danwilson<\/a>) on <a href=\"https:\/\/codepen.io\">CodePen<\/a>.<\/p>\n<p><script async src=\"https:\/\/production-assets.codepen.io\/assets\/embed\/ei.js\"><\/script><\/p>\n<p>Keyframe animations and transitions are not just for transforms, but transforms benefit greatly from the ability to animate between different states more efficiently by the browser.<\/p>\n<h3>The best friend of transforms<\/h3>\n<p>We can do a lot with transforms, but we can expand our options further when we introduce a complementary property. The transform-origin allows us to change the origin of our transformation. By default everything happens from the centre of the element. However, we can change the origin to any other point, in the same way we might change a background&#8217;s position. This changes how scales, rotations, and skews occur. For a rotation it changes the default from rotating around the centre of the element to rotating around the new point.<\/p>\n<p data-height=\"265\" data-theme-id=\"0\" data-slug-hash=\"EXqEZM\" data-default-tab=\"result\" data-user=\"danwilson\" data-embed-version=\"2\" data-pen-title=\"Animating transform-origin\" class=\"codepen\">See the Pen <a href=\"https:\/\/codepen.io\/danwilson\/pen\/EXqEZM\/\">Animating transform-origin<\/a> by Dan Wilson (<a href=\"https:\/\/codepen.io\/danwilson\">@danwilson<\/a>) on <a href=\"https:\/\/codepen.io\">CodePen<\/a>.<\/p>\n<p><script async src=\"https:\/\/production-assets.codepen.io\/assets\/embed\/ei.js\"><\/script><\/p>\n<p>You can similarly affect the visual result for scaling by using a different origin point.<\/p>\n<p data-height=\"265\" data-theme-id=\"0\" data-slug-hash=\"qXPdbw\" data-default-tab=\"css,result\" data-user=\"danwilson\" data-embed-version=\"2\" data-pen-title=\"Animating transform-origin (scale)\" class=\"codepen\">See the Pen <a href=\"https:\/\/codepen.io\/danwilson\/pen\/qXPdbw\/\">Animating transform-origin (scale)<\/a> by Dan Wilson (<a href=\"https:\/\/codepen.io\/danwilson\">@danwilson<\/a>) on <a href=\"https:\/\/codepen.io\">CodePen<\/a>.<\/p>\n<p><script async src=\"https:\/\/production-assets.codepen.io\/assets\/embed\/ei.js\"><\/script><\/p>\n<h3>But it&#8217;s not just about animation, right?<\/h3>\n<p>Animation can be a lot of fun, but transforms are certainly not limited to that realm. They can add design flourishes and lead to creative solutions, especially when combined with other CSS pieces like blend modes, clip paths, and more.<\/p>\n<p>However, really anything that requires a scaling or a rotation or needs a new position without affecting other elements&#8217; positions can get value from using transform.<\/p>\n<p>Some specific examples for inspiration: What if we want to have a circular menu where each item is laid out along the edge of circle? Rotate each item and translate them out to get each into position.<\/p>\n<p><code>li {<br \/>\n  transform: rotate(30deg) translateX(30vmin);<br \/>\n}<br \/>\nli:nth-child(2) {<br \/>\n  transform: rotate(60deg) translateX(30vmin);<br \/>\n}<br \/>\n\/* etc. *\/<\/code><\/p>\n<p>Without transforms, this would require specific calculations for each item to determine the x and y values for its position (which could then be combined with absolute positioning). If the circle&#8217;s dimensions or the number of items changed, the calculations would need to be reworked. With transforms we can take a more straightforward approach by specifying only the angle we want and the radius of the circle and let the browser do the calculation.<\/p>\n<p data-height=\"265\" data-theme-id=\"0\" data-slug-hash=\"6741bf585358edbbd89087ff9459e51a\" data-default-tab=\"css,result\" data-user=\"danwilson\" data-embed-version=\"2\" data-pen-title=\"Clock Setup\" data-editable=\"true\" class=\"codepen\">See the Pen <a href=\"https:\/\/codepen.io\/danwilson\/pen\/6741bf585358edbbd89087ff9459e51a\/\">Clock Setup<\/a> by Dan Wilson (<a href=\"https:\/\/codepen.io\/danwilson\">@danwilson<\/a>) on <a href=\"https:\/\/codepen.io\">CodePen<\/a>.<\/p>\n<p><script async src=\"https:\/\/production-assets.codepen.io\/assets\/embed\/ei.js\"><\/script><\/p>\n<p>Maybe you need something more basic like a frame around a photo?<\/p>\n<p data-height=\"265\" data-theme-id=\"0\" data-slug-hash=\"239deb33d0ad06142fe788a8beebdbbb\" data-default-tab=\"css,result\" data-user=\"danwilson\" data-embed-version=\"2\" data-pen-title=\"Picture Frame\" data-editable=\"true\" class=\"codepen\">See the Pen <a href=\"https:\/\/codepen.io\/danwilson\/pen\/239deb33d0ad06142fe788a8beebdbbb\/\">Picture Frame<\/a> by Dan Wilson (<a href=\"https:\/\/codepen.io\/danwilson\">@danwilson<\/a>) on <a href=\"https:\/\/codepen.io\">CodePen<\/a>.<\/p>\n<p><script async src=\"https:\/\/production-assets.codepen.io\/assets\/embed\/ei.js\"><\/script><\/p>\n<p>Or when you want to take transforms to the next level, take a look at some options we did not even get to touch on with 3D and the Z axis:<\/p>\n<p data-height=\"265\" data-theme-id=\"0\" data-slug-hash=\"zzWKyM\" data-default-tab=\"css,result\" data-user=\"danwilson\" data-embed-version=\"2\" data-pen-title=\"Visual Reference: 3D Transform Functions\" class=\"codepen\">See the Pen <a href=\"https:\/\/codepen.io\/danwilson\/pen\/zzWKyM\/\">Visual Reference: 3D Transform Functions<\/a> by Dan Wilson (<a href=\"https:\/\/codepen.io\/danwilson\">@danwilson<\/a>) on <a href=\"https:\/\/codepen.io\">CodePen<\/a>.<\/p>\n<p><script async src=\"https:\/\/production-assets.codepen.io\/assets\/embed\/ei.js\"><\/script><\/p>\n<p>Whether you want to simply position something visually or you want to dig in and create performant animations, the transform property can help get you there. This property encompasses a lot of options, so start exploring it, start playing with it, and see how it might help you.<\/p>\n<h3>Additional reading:<\/h3>\n<ul>\n<li><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/CSS_Transforms\/Using_CSS_transforms\" target=\"_blank\">Using CSS transforms<\/a><\/li>\n<li><a href=\"http:\/\/desandro.github.io\/3dtransforms\/\" target=\"_blank\">Intro to CSS 3D transforms<\/a><\/li>\n<li><a href=\"https:\/\/tympanus.net\/codrops\/css_reference\/transform\/\" target=\"_blank\">Codrops CSS Reference: transform<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>With a single line of CSS, we can completely reorient any element &#8211; moving, rotating, resizing, and more.  Dan Wilson gets into the transform property and how you can use it to change everything on your site.<\/p>\n","protected":false},"author":2,"featured_media":17019,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,24],"tags":[],"class_list":{"0":"post-17015","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-guest-posts","8":"category-web-design"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Discover the Power of CSS Transforms - Heart Internet<\/title>\n<meta name=\"description\" content=\"With a single line of CSS, we can completely reorient any element. Dan Wilson gets into the transform property and how you can use it to change your site.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Discover the Power of CSS Transforms - Heart Internet\" \/>\n<meta property=\"og:description\" content=\"With a single line of CSS, we can completely reorient any element. Dan Wilson gets into the transform property and how you can use it to change your site.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/\" \/>\n<meta property=\"og:site_name\" content=\"Heart Internet\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/heartinternet\/\" \/>\n<meta property=\"article:published_time\" content=\"2017-08-30T11:30:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.heartinternet.uk\/blog\/wp-content\/uploads\/2017\/08\/csstransforms-background.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1265\" \/>\n\t<meta property=\"og:image:height\" content=\"500\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Eliot Chambers-Ostler\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@heartinternet\" \/>\n<meta name=\"twitter:site\" content=\"@heartinternet\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Eliot Chambers-Ostler\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/\"},\"author\":{\"name\":\"Eliot Chambers-Ostler\",\"@id\":\"https:\/\/heartblog.victory.digital\/#\/schema\/person\/58ed7f27cc0f3ab6e69135742a5eee28\"},\"headline\":\"Discover the Power of CSS Transforms\",\"datePublished\":\"2017-08-30T11:30:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/\"},\"wordCount\":1926,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/heartblog.victory.digital\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.heartinternet.uk\/blog\/wp-content\/uploads\/2017\/08\/csstransforms-background.jpg\",\"articleSection\":[\"Guest Posts\",\"Web Design\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/\",\"url\":\"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/\",\"name\":\"Discover the Power of CSS Transforms - Heart Internet\",\"isPartOf\":{\"@id\":\"https:\/\/heartblog.victory.digital\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.heartinternet.uk\/blog\/wp-content\/uploads\/2017\/08\/csstransforms-background.jpg\",\"datePublished\":\"2017-08-30T11:30:43+00:00\",\"description\":\"With a single line of CSS, we can completely reorient any element. Dan Wilson gets into the transform property and how you can use it to change your site.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/#primaryimage\",\"url\":\"https:\/\/www.heartinternet.uk\/blog\/wp-content\/uploads\/2017\/08\/csstransforms-background.jpg\",\"contentUrl\":\"https:\/\/www.heartinternet.uk\/blog\/wp-content\/uploads\/2017\/08\/csstransforms-background.jpg\",\"width\":1265,\"height\":500},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.heartinternet.uk\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Discover the Power of CSS Transforms\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/heartblog.victory.digital\/#website\",\"url\":\"https:\/\/heartblog.victory.digital\/\",\"name\":\"Heart Internet\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/heartblog.victory.digital\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/heartblog.victory.digital\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/heartblog.victory.digital\/#organization\",\"name\":\"Heart Internet\",\"url\":\"https:\/\/heartblog.victory.digital\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/heartblog.victory.digital\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.heartinternet.uk\/blog\/wp-content\/uploads\/2025\/02\/HeartInternet_Logo_Colour.webp\",\"contentUrl\":\"https:\/\/www.heartinternet.uk\/blog\/wp-content\/uploads\/2025\/02\/HeartInternet_Logo_Colour.webp\",\"width\":992,\"height\":252,\"caption\":\"Heart Internet\"},\"image\":{\"@id\":\"https:\/\/heartblog.victory.digital\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/heartinternet\/\",\"https:\/\/x.com\/heartinternet\",\"https:\/\/www.linkedin.com\/company\/heart-internet-ltd\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/heartblog.victory.digital\/#\/schema\/person\/58ed7f27cc0f3ab6e69135742a5eee28\",\"name\":\"Eliot Chambers-Ostler\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/heartblog.victory.digital\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.heartinternet.uk\/blog\/wp-content\/uploads\/2025\/08\/cropped-Eliot-96x96.jpg\",\"contentUrl\":\"https:\/\/www.heartinternet.uk\/blog\/wp-content\/uploads\/2025\/08\/cropped-Eliot-96x96.jpg\",\"caption\":\"Eliot Chambers-Ostler\"},\"url\":\"https:\/\/www.heartinternet.uk\/blog\/author\/eliot-chambers-ostler\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Discover the Power of CSS Transforms - Heart Internet","description":"With a single line of CSS, we can completely reorient any element. Dan Wilson gets into the transform property and how you can use it to change your site.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/","og_locale":"en_GB","og_type":"article","og_title":"Discover the Power of CSS Transforms - Heart Internet","og_description":"With a single line of CSS, we can completely reorient any element. Dan Wilson gets into the transform property and how you can use it to change your site.","og_url":"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/","og_site_name":"Heart Internet","article_publisher":"https:\/\/www.facebook.com\/heartinternet\/","article_published_time":"2017-08-30T11:30:43+00:00","og_image":[{"width":1265,"height":500,"url":"https:\/\/www.heartinternet.uk\/blog\/wp-content\/uploads\/2017\/08\/csstransforms-background.jpg","type":"image\/jpeg"}],"author":"Eliot Chambers-Ostler","twitter_card":"summary_large_image","twitter_creator":"@heartinternet","twitter_site":"@heartinternet","twitter_misc":{"Written by":"Eliot Chambers-Ostler","Estimated reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/#article","isPartOf":{"@id":"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/"},"author":{"name":"Eliot Chambers-Ostler","@id":"https:\/\/heartblog.victory.digital\/#\/schema\/person\/58ed7f27cc0f3ab6e69135742a5eee28"},"headline":"Discover the Power of CSS Transforms","datePublished":"2017-08-30T11:30:43+00:00","mainEntityOfPage":{"@id":"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/"},"wordCount":1926,"commentCount":2,"publisher":{"@id":"https:\/\/heartblog.victory.digital\/#organization"},"image":{"@id":"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/#primaryimage"},"thumbnailUrl":"https:\/\/www.heartinternet.uk\/blog\/wp-content\/uploads\/2017\/08\/csstransforms-background.jpg","articleSection":["Guest Posts","Web Design"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/","url":"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/","name":"Discover the Power of CSS Transforms - Heart Internet","isPartOf":{"@id":"https:\/\/heartblog.victory.digital\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/#primaryimage"},"image":{"@id":"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/#primaryimage"},"thumbnailUrl":"https:\/\/www.heartinternet.uk\/blog\/wp-content\/uploads\/2017\/08\/csstransforms-background.jpg","datePublished":"2017-08-30T11:30:43+00:00","description":"With a single line of CSS, we can completely reorient any element. Dan Wilson gets into the transform property and how you can use it to change your site.","breadcrumb":{"@id":"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/#primaryimage","url":"https:\/\/www.heartinternet.uk\/blog\/wp-content\/uploads\/2017\/08\/csstransforms-background.jpg","contentUrl":"https:\/\/www.heartinternet.uk\/blog\/wp-content\/uploads\/2017\/08\/csstransforms-background.jpg","width":1265,"height":500},{"@type":"BreadcrumbList","@id":"https:\/\/www.heartinternet.uk\/blog\/discover-the-power-of-css-transforms\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.heartinternet.uk\/blog\/"},{"@type":"ListItem","position":2,"name":"Discover the Power of CSS Transforms"}]},{"@type":"WebSite","@id":"https:\/\/heartblog.victory.digital\/#website","url":"https:\/\/heartblog.victory.digital\/","name":"Heart Internet","description":"","publisher":{"@id":"https:\/\/heartblog.victory.digital\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/heartblog.victory.digital\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/heartblog.victory.digital\/#organization","name":"Heart Internet","url":"https:\/\/heartblog.victory.digital\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/heartblog.victory.digital\/#\/schema\/logo\/image\/","url":"https:\/\/www.heartinternet.uk\/blog\/wp-content\/uploads\/2025\/02\/HeartInternet_Logo_Colour.webp","contentUrl":"https:\/\/www.heartinternet.uk\/blog\/wp-content\/uploads\/2025\/02\/HeartInternet_Logo_Colour.webp","width":992,"height":252,"caption":"Heart Internet"},"image":{"@id":"https:\/\/heartblog.victory.digital\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/heartinternet\/","https:\/\/x.com\/heartinternet","https:\/\/www.linkedin.com\/company\/heart-internet-ltd"]},{"@type":"Person","@id":"https:\/\/heartblog.victory.digital\/#\/schema\/person\/58ed7f27cc0f3ab6e69135742a5eee28","name":"Eliot Chambers-Ostler","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/heartblog.victory.digital\/#\/schema\/person\/image\/","url":"https:\/\/www.heartinternet.uk\/blog\/wp-content\/uploads\/2025\/08\/cropped-Eliot-96x96.jpg","contentUrl":"https:\/\/www.heartinternet.uk\/blog\/wp-content\/uploads\/2025\/08\/cropped-Eliot-96x96.jpg","caption":"Eliot Chambers-Ostler"},"url":"https:\/\/www.heartinternet.uk\/blog\/author\/eliot-chambers-ostler\/"}]}},"_links":{"self":[{"href":"https:\/\/www.heartinternet.uk\/blog\/wp-json\/wp\/v2\/posts\/17015","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.heartinternet.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.heartinternet.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.heartinternet.uk\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.heartinternet.uk\/blog\/wp-json\/wp\/v2\/comments?post=17015"}],"version-history":[{"count":0,"href":"https:\/\/www.heartinternet.uk\/blog\/wp-json\/wp\/v2\/posts\/17015\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.heartinternet.uk\/blog\/wp-json\/wp\/v2\/media\/17019"}],"wp:attachment":[{"href":"https:\/\/www.heartinternet.uk\/blog\/wp-json\/wp\/v2\/media?parent=17015"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.heartinternet.uk\/blog\/wp-json\/wp\/v2\/categories?post=17015"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.heartinternet.uk\/blog\/wp-json\/wp\/v2\/tags?post=17015"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}