Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 1st, 2006, 01:29 PM
Registered User
Join Date: Apr 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default How can we put the Table in the center of browser

Hi All

This problem comes when I am creating aspx pages using through Visual Studio 2003. The page

come absolutely fine when it is created through Dreamweaver or Web matrix

I have an aspx web page in which I have inserted a HTML table. In this table I have inserted

all the server controls so that it get formatted properly. Now when I run this application,

the table comes at the exact position where I have left it at the time of designing(mostly left hand corner). I want that the table and all its contents should come exactly at the center of the screen and not to the default position.

If I create the same thing in Dreamweaver and set the align property of the table to "center"

then the tables comes exactly in the center of the screen

But when I do the same thing in the Visual Studio it shows the table at the default position

and not the center.

In short, how can we put the Table and the contents in an aspx form so that it always comes

in the center of the browser at any size of the screen (600*800 or 1024*768 etc)

Keenly waiting for a response

Thanks in advance

Nitin Suri
Old April 2nd, 2006, 04:09 AM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

Hi there,

This is probably caused by the doc type of the page. Depending on the version and configuration of your tools, you get a doc type that tells the browser to render in standards mode.

To center a table, you can set the margin of it to "auto" in a style attribute, like this:
<table style="border:1px solid black; width: 200px; margin: auto;">
  <td>Hello World</td>
If that doesn't help, can you show us some code so we can advice you how to proceed?

Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004

Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick question put image in table cell user0b PHP How-To 0 June 26th, 2008 10:56 PM
Trying to center a table with scrollbar Sickopuppie HTML Code Clinic 5 June 15th, 2006 02:43 AM
How can we put the Table in the center of browser? nitinsuri1980 ASP.NET 1.0 and 1.1 Basics 1 April 1st, 2006 10:00 PM
How to put a control inside a table cell? zach2004 ASP.NET 1.x and 2.0 Application Design 7 March 8th, 2004 03:28 PM
How do I put this into a table? stacy Classic ASP Databases 3 February 3rd, 2004 07:52 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.