www.webdeveloper.com
Results 1 to 2 of 2

Thread: centering a nested element.

  1. #1
    Join Date
    Nov 2013
    Posts
    4

    centering a nested element.

    so i still can't get it the way i want it. I got halfway there though. text-align:center will center the text on the x axis, how to you center it vertically? I mean i can use positioning-top then half the height of the div, but that seems retarded to me.

    <style>
    section {
    height:100px;
    width:100px;
    border:1px solid black;
    text-align:center;
    }
    p {
    display:inline;
    background-color:red;
    }
    </style>
    </head>
    <body>
    <section>
    <p>hey</p>
    </section>

  2. #2
    Join Date
    Jan 2004
    Location
    chertsey, a small town s.w. of london, england.
    Posts
    1,460

    This problem has been answered here...

    coothead

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles