Solved

centering a table vertically in a div with CSS

Posted on 2014-07-18
2
134 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:
xDJR1875 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

746 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

12 Experts available now in Live!

Get 1:1 Help Now