?
Solved

centering a table vertically in a div with CSS

Posted on 2014-07-18
2
Medium Priority
?
148 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

by:
Daniel Reynolds earned 1200 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 800 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
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 …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

764 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