Vertical (rotated) text in HTML table

前端 未结 11 1587
长发绾君心
长发绾君心 2020-11-28 20:30

Is there a (portable) way to rotate text in a HTML table cell by 90°?

(I have a table with many columns and much text for the headings, so I\'d like to write it vert

11条回答
  •  北荒
    北荒 (楼主)
    2020-11-28 21:08

    Alternate Solution?

    Instead of rotating the text, would it work to have it written "top to bottom?"

    Like this:

    S  
    O  
    M  
    E  
    
    T  
    E  
    X  
    T  
    

    I think that would be a lot easier - you can pick a string of text apart and insert a line break after each character.

    This could be done via JavaScript in the browser like this:

    "SOME TEXT".split("").join("\n")
    

    ... or you could do it server-side, so it wouldn't depend on the client's JS capabilities. (I assume that's what you mean by "portable?")

    Also the user doesn't have to turn his/her head sideways to read it. :)

    Update

    This thread is about doing this with jQuery.

提交回复
热议问题