Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8191055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:49:52+00:00 2026-06-07T03:49:52+00:00

The point is that I have set vertical-align: center property I have a p

  • 0

The point is that I have set vertical-align: center property

I have a p:

<p><span>Hello World</span></p>​

p{
    text-align:center;
    height:200px;
    width:200px;
    border:1px black solid;
}
span{
    vertical-align: middle;
    display:inline-block;
}

Here is the demo:http://jsfiddle.net/hh54188/yhLqV/2/

I want the text in the paragraph could be center at both vertical and horizontal direction

but the span‘s vertical-align property doesn’t work?Why?

I get some advises about set the line-height equal to the parent’s height, it works only when there is only one line in the parent box.

How can I achieve my goal(may be I can use some css3 property)? Set the inner element at the center of parent vertical direction

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T03:49:54+00:00Added an answer on June 7, 2026 at 3:49 am

    Hi you can achieve your desired results through the mentioned below CSS code :-

    You can give the display:table to the parent and display:table-cell; & vertical-align:middle; to the Child than you will be to get your desired results as mentioning below the CSS & Demo link…

    CSS

    p{
        text-align:center;
        height:200px;
        width:200px;
        border:1px black solid;
        display:table;
    
    }
    span{
        vertical-align: middle;
        display:table-cell;
    } 
    

    here is the demo :- http://jsfiddle.net/yhLqV/5/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

At work have a set of floating point values that I sort and compute
I have a set of points that i want to turn into a closed
I have a set of X,Y data points (about 10k) that are easy to
I have a batch of reports that are set up to print very nicely
I have a strange problem getting the color of the point that was touched.
I have to open an NSStream to a wifi access point that has only
Say that I have an immutable Point class with x and y parameters, and
I have two domains that point to the same IP, which is an Ubuntu
I have executed a rawQuery in android that returns multiple results that point to
i have bug that i cannot find, i have Class Point with method who

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.