Solved

centering a table vertically in a div with CSS

Posted on 2014-07-18
2
138 Views
Last Modified: 2014-07-21
I have this example:

http://jsfiddle.net/GS5f3/

This example has a div with a table in it. Right now it seems my table is vertically at the top of my div

When I run it it seems the table is not centered vertically in my div.

How do I fix it so my table is centered vertically on my div?
0
Comment
Question by:maqskywalker
2 Comments
 
LVL 17

Accepted Solution

by:
Daniel Reynolds earned 300 total points
ID: 40205725
just position the table relatively within the div and give it top: 50% and left: 50%.

You can take out the left and just use top

http://jsfiddle.net/EZk3T/1/

:: competing site link removed ::
0
 
LVL 58

Assisted Solution

by:Gary
Gary earned 200 total points
ID: 40205790
Easiest way is to add this to your container div css
http://jsfiddle.net/GS5f3/2/

display: table-cell;
vertical-align: middle;

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

679 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