Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] How to center text in a rotated div

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #163447
    skeeterz71
    Participant

    Hi,

    I have a div rotated 45 degrees. In the div I have a paragraph tag with text rotated -45 degrees so it will be horizontal level. However, when I try to use text align center it throws the text off to the right. How do I center the text horizontal and vertical in a rotated div?

    Thanks

    #163450
    skeeterz71
    Participant

    Nevermind. I found the answer here:
    https://css-tricks.com/centering-in-the-unknown/
    Using the “ghost” element inside the parent that is 100% height — method which is the last example on the page of how-to accomplish this. Works perfect.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘CSS’ is closed to new topics and replies.