vertical centering a <p> tag in a div.. automatically

Posted on 2012-08-31
Last Modified: 2012-08-31
I have a fixed height div and I want to center a <p> tag that will vary in length, so it has to center vertical inside the div automatically.  I tried padding:0 auto 0 auto; and it didn't work.

How can this be done?   It's wordpress so I assume css 3 is available
Question by:tf2012
    LVL 70

    Accepted Solution

    Just FYI, WordPress has absolutely nothing to do with CSS 3.  CSS support is browser-based whereas WordPress just writes code you tell it to write.

    When you say the p tag has to center vertically in a div, is it always the one p tag and div or is this something that would need to be applied multiple times in a given page/post?
    LVL 1

    Author Closing Comment

    Thanks for replying, it seems to sit well without trying to force any centering on it so I'll close the question.  Re CSS3.... thanks.. I was automatically equating html5 & css 3 with word press but you are right.

    Featured Post

    Live: Real-Time Solutions, Start Here

    Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

    Join & Write a Comment

    Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    The viewer will learn how to count occurrences of each item in an array.
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    754 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now