Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to display text at an angle in a web page?

Tags:

html

text

css

angle

I would like to know whether it is possible or not to create text in a web page at an angle, for example at 40 Degrees. If it is possible, how can I do this?

EDIT: Finally, I decided to go with Mathias Bynens's answer.

like image 909
Ryan S Avatar asked Mar 23 '11 10:03

Ryan S


2 Answers

Use CSS3 transforms:

.selector {
  -webkit-transform: rotate(40deg);
  -moz-transform: rotate(40deg);
  -o-transform: rotate(40deg);
  transform: rotate(40deg);
}

IE does support filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);, where the rotation property accepts one of four values: 0, 1, 2, or 3 which will rotate the element 0, 90, 180 or 270 degrees respectively. It’s a filter though, so I wouldn’t recommended using it.

like image 145
Mathias Bynens Avatar answered Sep 19 '22 18:09

Mathias Bynens


To add to Mathias' answer, you can rotate text in IE, too: http://snook.ca/archives/html_and_css/css-text-rotation

However, you are bound to multiples of 90°.

Apart from that you could utilize SVG/VML for rotated text. Look, for example, at this page: http://raphaeljs.com/text-rotation.html

It uses the RaphaelJS library for cross browser text rotation without images.

like image 24
Boldewyn Avatar answered Sep 18 '22 18:09

Boldewyn