CSS transforms tutorial: Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
Line 31: Line 31:
=== Translation and rotation ===
=== Translation and rotation ===


<source lang="html5" enclode="div">
<source lang="html5" enclose="div">
<div style="background-color:blue; height: 100px; width: 100px; transform-origin: 50px 50px; transform: translate(50px, 20px) rotate(45deg);"></div>
<div style="background-color:blue; height: 100px; width: 100px; transform-origin: 50px 50px; transform: translate(50px, 20px) rotate(45deg);"></div>
</source>
</source>

Revision as of 15:54, 27 August 2013

Draft

<pageby nominor="false" comments="false"/>

Learning goals
  • Be able to create simple CSS transforms
Prerequisites
Level and target population
  • Beginners
Teaching materials
  • Example text: ....
Remarks
  • This tutorial is intended for students in educational technology or any other field that is technology intensive. For people who need less, there exist many easy CSS tutorials on the web. This text is intended for students who also must learn principles and who are willing to learn CSS by doing a project, looking at CSS code and online reference manuals.
  • Ideally, a teacher also should assign a text formatting task, during or before assigning this tutorial for reading).

Introduction

“CSS transforms allows elements styled with CSS to be transformed in two-dimensional or three-dimensional space. This specification is the convergence of the CSS 2D transforms, CSS 3D transforms and SVG transforms specifications.

The CSS visual formatting model describes a coordinate system within each element is positioned. Positions and sizes in this coordinate space can be thought of as being expressed in pixels, starting in the origin of point with positive values proceeding to the right and down. This coordinate space can be modified with the transform property [plus some "helper" properties]. Using transform, elements can be translated, rotated and scaled in two or three dimensional space.” CSS Transforms, retrieved Aug 27, 2013).

Simple examples

Translation and rotation

<div style="background-color:blue; height: 100px; width: 100px; transform-origin: 50px 50px; transform: translate(50px, 20px) rotate(45deg);"></div>

Links

Official