473,321 Members | 1,778 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

How to vertical center a table in a <div> container

Claus Mygind
571 512MB
I don't seem to be able to do a vertical center on the table contained in this <div> </div> tag. What needs to be done?


Expand|Select|Wrap|Line Numbers
  1. <div id="container" style="height:90%; width:95%; white-space:nowrap; border:5px solid red;margin: auto;">
  2.     <table style="margin: auto; vertical-align:center; border:2px solid blue;">
  3.         <tbody>
  4.             <tr>
  5.                 <td align="right" >Initials:</td>
  6.                 <td><input type="text" name=""></td>
  7.             </tr><tr>
  8.                 <td>Engineer's Name:</td>
  9.             </tr><tr>
  10.                 <td align="right" >First Name:</td>
  11.                 <td><input type="text" /></td>
  12.             </tr><tr>
  13.                 <td align="right" >Last Name:</td>
  14.                 <td><input type="text"/></td>
  15.             </tr>
  16.         </tbody>
  17.     </table>
  18. </div>
  19.  
Nov 19 '12 #1
2 2631
Rangan
8
Instead of setting margin:auto margin-left:10px and margin-top:10;

increasing left and top position table will center aligned by vertically.

check this will help you too..
Dec 14 '12 #2
Here is the correction code..
for more help <link removed>
Expand|Select|Wrap|Line Numbers
  1.   <div id="container" style="display:table-cell;vertical-align:middle;height:1000px; width:95%; white-space:nowrap; border:5px solid red;margin: auto;">
  2.       <table style="margin:0 auto; border:2px solid blue;">
  3.             <tbody>
  4.                 <tr>
  5.                     <td align="right" >Initials:</td>
  6.                     <td><input type="text" name=""></td>
  7.                 </tr><tr>
  8.                     <td>Engineer's Name:</td>
  9.                 </tr><tr>
  10.                     <td align="right" >First Name:</td>
  11.                     <td><input type="text" /></td>
  12.                 </tr><tr>
  13.                     <td align="right" >Last Name:</td>
  14.                     <td><input type="text"/></td>
  15.                 </tr>
  16.             </tbody>
  17.         </table>
  18.     </div>
Dec 29 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: News | last post by:
Hi All, I'm trying to center a StyleSheet like below : <div id="CenterThis" style="position:absolute; top:40px; left:70px;">This should be centered</div> With this code : <script...
19
by: CMAR | last post by:
I have the following markup. The problem is that the browser, e.g., IE6, inserts several lines of blank space between the <div> and the following table. Is there a way to minimize that vertical...
9
by: Julia Briggs | last post by:
How do I construct a <iframe> or equivalent for FireFox/NS browsers, inside a screen centered <div> tag? Can it be done?
15
by: scott | last post by:
Hello, I'm working on updating some of my table-based sites to use CSS instead of tables. One of my sites has a header that is composed of three elements: A B C In my prior design, this was...
5
by: Stan R. | last post by:
Greetings. I have a couple of questions concerning CSS layouts, as apposed to the old <tablemethod for creating layouts . Even after spending the last few days searching all over Google Groups, I...
3
by: rsteph | last post by:
I'm using two divs to create a shadowed-box type effect. Within the top div I want to put an image. I can get the image to center right to left, but not top to bottom. I'm making a series of boxes,...
1
by: Carl | last post by:
Hi all I have a javascript function that drags and drops an element (ie img) into a container (ie bordered div). The function works and returns the element and and container. My next step is to...
4
n8kindt
by: n8kindt | last post by:
i have no idea what to do on this one. no <div> containers were previously on any of the pages used with this stylesheet. i just started tinkering with javascript and decided it would make sense to...
8
prino
by: prino | last post by:
Hi all, I've written code (in REXX) that takes files in legacy languages (PL/I, COBOL, z/OS assembler, etc) and converts them into HTML in a format similar to what's displayed in the z/OS ISPF...
1
Claus Mygind
by: Claus Mygind | last post by:
When I design my pages, I am putting the content into <div> tags. For example I may have two <div> tags side by side content on left and on the right. My problem is this, if I want to select...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.