Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Rotate text in header of table

Posted on 2014-03-06
5
Medium Priority
?
1,155 Views
Last Modified: 2016-09-23
I'm trying to rotate some header texts in a table, however it seems to be a right mess. Im not great at CSS, and really dont understand the mess it causes and how to fix

Would it be possible for someone to assist me in sorting my mess out :-(
http://jsfiddle.net/UNj7d/
0
Comment
Question by:tonelm54
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 39910877
I suggest using a jquery plugin
http://davidjs.com/2011/07/rotate-table-cell-content-jquery/

Getting this to work properly cross browser is a ****
0
 

Author Comment

by:tonelm54
ID: 39911044
Thanks Gary, I had looked at that before, however I wanted to rotate by 270 (or -90) instead of 90 (+90), however I had the same issue as 'Timothy Watson' who also couldnt rotate the text the other way :-(
0
 
LVL 58

Expert Comment

by:Gary
ID: 39911064
You just need to change the CSS to -90

I'm sure this is the one I used some time back, I'll throw a fiddle together now.
0
 
LVL 58

Accepted Solution

by:
Gary earned 2000 total points
ID: 39911150
Sometimes its easier just doing it yourself

http://jsfiddle.net/GaryC123/UNj7d/9/

jQuery in question
var w=0
$("#Table1 th").each(function(){
    $(this).html('<div class="rotated">' + $(this).html() + '</div>')
    $(this).width()>w?w=$(this).width():w=w
})
$("#Table1 th div").each(function(){
    $(this).css("margin-top",(w-$(this).width()+5)+"px")
})

Open in new window

May need some tweaking
0
 

Expert Comment

by:Pius Anyebe
ID: 41812306
I came accross this and it worked fine... Now id like one of my table header Horizontal. How  can i achieve that using your script..
am not good with javascript yet.
thanks
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When applying CSS to your HTML, there are many different ways to select which element(s) the CSS applies to.  Some of these selectors are more commonly known and used than others - Here are the more common ones: #X - Matches an ID of X .X - Matche…
When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question