Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rotate just the text in a CSS button

i ve created a css button. I want to rotate the text vertical in button but just only the text. How can i achieve this. My css button code:

.button_example{

border:1px solid #7d99ca; 
-webkit-border-radius: 3px; 
display: table-column-group;
/*-webkit-transform: rotate(-90deg); rotate the whole button*/
-moz-border-radius: 3px;
border-radius: 5px;
font-size:22px;
font-family:Impact, Charcoal, sans-serif; 
padding: 10px 10px 10px 10px; 
text-decoration:none; 
display:inline-block;
text-shadow: -1px -1px 0 rgba(0,0,0,0.3);
font-weight:strong; 
color: #00a19c;
color: #3388fa;


 background: transparent;   /* size and positioning*/
 margin-left: 121px;
 margin-top: 1px;
 width: 24px;
 height: 485px; 
 font-size:14px;
 font-weight:700;
 position:absolute;left:1120px;top:180px;

background-image: linear-gradient(to bottom, #FFFFFF, #FFFFFF);
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#FFFFFF, endColorstr=#FFFFFF);

}

Any idea how to rotate just the text?

like image 330
Jose Ramon Avatar asked Dec 26 '22 19:12

Jose Ramon


1 Answers

I don't know any other way to accomplish this without adding a span (or any other inline element) within the button, to apply the transform styles on.

CSS:

button span {
    display: inline-block;
    transform: rotate(-90deg);
}

HTML:

<button><span>Your Text</span></button>

Remember to add vendor prefixes (-moz, -webkit, -ms, ...) and fallbacks for Internet Explorer as it doesn't support rotating in lower versions without a filter.

Here is a basic sample on rotating with CSS: http://css-tricks.com/snippets/css/text-rotation/

like image 183
Sven Finger Avatar answered Jan 10 '23 18:01

Sven Finger