Modern browsers and CSS3 begins to allow us much more freedom using standard text without the need of images. Not only does this speed up page load times, it also lowers bandwidth costs as well. Using CSS3, many standard DOM (Document Object Model) objects can easily be rotated, such as: images, text, block elements, etc…
Let’s explore how we can use the transform CSS property to accomplish this.
To begin, some basic HTML is required before we can apply the CSS code to it. In the example below, I will demonstrate creating a menu with the word menu being rotated:
[code]
<div id=”content”>
Some content goes here in the middle…
<div id=”menu”>
Menu
</div>
</div>
[/code]
Next, the CSS must be added to rotate the word menu so that it will appear vertically:
[code]
#menu {
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
transform: rotate(-90deg);
}
[/code]
Summary of CSS transformations
With a bit more CSS, the following example can be produced without the need of a single issue:
Using some CSS3, rotating text or images or many other DOM elements is now extremely simple!