473,399 Members | 3,401 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,399 software developers and data experts.

I want a table to be centered in the center of the page

My code,
Expand|Select|Wrap|Line Numbers
  1. <table align="center" bgcolor="lightblue">
  2.                         <tr>
  3.                             <td>UserName</td>
  4.                             <td><input type="text" name="user"/></td>
  5.                         </tr>
  6.                         <tr>
  7.                             <td>PassWord</td>
  8.                             <td><input type="password" name="pwd"/></td>
  9.                         </tr>
  10.                         <tr align="center">
  11.                             <td colspan="2"><input type="submit" value="Login"/></td>
  12.                         </tr>
  13.                     </table> 
Jan 19 '12 #1
3 1755
C CSR
144 100+
You can use this below and DIVs. If your tables a childNode, find its parent.

Expand|Select|Wrap|Line Numbers
  1. <body>
  2. <CENTER>
  3.  
Jan 19 '12 #2
lgm001
9
Arghhh... Don't use <center></center>... its been deprecated...

Okay... set a width on your table...
<table style="width: 800px; margin: 0 auto;">
...
</table>

what this does is it makes the top and bottom margin 0, and sets the left and right to whatever is left. Thus you get a centered div or image or whatever.
Jan 25 '12 #3
C CSR
144 100+
Okay. You caught me. Thanks for the "wake up!"
Jan 25 '12 #4

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

Similar topics

0
by: b.orsini | last post by:
Is it possible to know if a row is the first row in a table after a page break ? After a page break, the header is put in the page ( it's ok ) but in some case i must display the first row...
3
by: Stan Brown | last post by:
Look at http://www.acad.sunytccc.edu/instruct/sbrown/ in almost any browser, including IE4 and IE6, and you'll see the table is centered. Now look at it in IE 5 for Windows and you'll see the...
8
by: Freek te Water | last post by:
Hi, Hope no-one is offended by my probably noob question... Context: I have a web page design, which always centres in the middle of the screen (using a 100%*100% HTML-table). Now I also use...
0
by: Dude | last post by:
I am using new_range.InsertAfter txt new_range.ConvertToTable vbTab new_range.InsertBreak new_range.InsertAfter txt2 new_range.ConvertToTable vbTab new_range.InsertBreak
4
by: Just Me | last post by:
In the handler QueryPageSettings I let the user select a "Skip This Page" option. But I don't know how to handle it if he does. I can set a flag and in PrintPage skip printing the page but the...
1
by: archnavish | last post by:
Hi, Is it possible to set focus to a table header during page load? My web page is basically a search-display kind of a page. The search results get displayed in a tabular fashion once the search...
3
by: dubing | last post by:
Hi, I'm trying to do align table center in CSS like this. But it doesn't work. ..tx-gooffotoboek-pi1 table { text-align: center; } I can do <table align="center"but it's said deprecated....
2
by: antonio_wn8 | last post by:
Hi all, I have a need to read and parse a table in HTML page. I’m using the following script: http://trac.davidgrant.ca/browser/src/python/misc/siteuptime/TableParser.py It works fine aside...
10
by: jerrydigital | last post by:
Hi, I am trying to make my table on an asp page cleaner. Right now, I have an html table on my page that draws information from my database. The customer can enter the following on the...
41
by: elham477 | last post by:
I have two pages. The first page contain a table with title and the second contain texts & selected option. I want it so when a user in second page clicks the submit button, his information is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.