Reputation: 43
How to have text in Vertical in PHP ??
I need text to be displayed in vertical style in Table Td text
it should print vertical or i need it to rotate ?
Upvotes: 1
Views: 8098
Reputation: 51640
That does not have anything to do with PHP.
Just use the proper CSS properties
http://www.w3.org/TR/2001/WD-css3-text-20010517/#PrimaryTextAdvanceDirection
EDIT: sorry, I thought this was cross-browser, but it looks like it only works in IE
You can use -webkit-transform: rotate(-90deg);
or -moz-transform: rotate(-90deg);
for cross-browser compatibility.
Upvotes: 4
Reputation: 94123
Assuming you want your output to be actual text, and not a graphic, you'll need to use CSS text rotation. Text rotation isn't currently part of the standard (though CSS3 should change that) and is generally supported by way of browser-specific prefixes (-webkit-transform for webkit, -moz-transform for Mozilla browsers) or text filters (IE).
This article provides a good overview on how to use CSS text rotation in a cross-browser way.
Upvotes: 1
Reputation: 382646
CSS:
For FF 3.5 or Safari/Webkit 3.1, check out: -moz-transform (and -webkit-transform). IE has a Matrix filter(v5.5+).
.rot-neg-90 {
/* rotate -90 deg, not sure if a negative number is supported so I used 270 */
-moz-transform: rotate(270deg);
-moz-transform-origin: 50% 50%;
-webkit-transform: rotate(270deg);
-webkit-transform-origin: 50% 50%;
/* IE support too convoluted for the time I've got on my hands... */
}
PHP: (Since OP had tagged PHP)
If you meant vertical text on an image however, try:
header ("Content-type: image/png");
// imagecreate (x width, y width)
$img_handle = @imagecreatetruecolor (15, 220) or die ("Cannot Create image");
// ImageColorAllocate (image, red, green, blue)
$back_color = ImageColorAllocate ($img_handle, 0, 0, 0);
$txt_color = ImageColorAllocate ($img_handle, 255, 255, 255);
ImageStringUp ($img_handle, 2, 1, 215, $_GET['text'], $txt_color);
ImagePng ($img_handle);
ImageDestroy($img_handle);
Upvotes: 5