powered by Slim Framework
enhanced by Nesbot.com

CSS3: Rotating DOM Elements

Published on Mar 5, 2012 by Jamie Munro

As more and more browsers support HTML5 and more importantly CSS3, it 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…




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:


<div id="content">
Some content goes here in the middle…
<div id="menu">
Menu
</div>
</div>


Next, the CSS must be added to rotate the word menu so that it will appear vertically:


#menu {
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
transform: rotate(-90deg);
}


With a bit more CSS, the following example can be produced without the need of a single issue:


Summary


Using some new CSS3, rotating text or images or many other DOM elements is now extremely simple!

Tags: css3 | CSS

<- MySQL: Concatenate Multiple Rows From a Table Into One Field  Home MSSQL/MySQL: Delete Duplicate Rows in a Table -> 
blog comments powered by Disqus