Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Table size and centred?

Author  Topic 

Richy1
Starting Member

27 Posts

Posted - 2007-05-11 : 09:53:51
Hi all, this is such a simple thing but its driving me nuts! Im making a master page right now, 3 columns in a table. An image at the top, and another at the bottom, very simple. But for the life of me, i cannot centre the table, and i have this white line around the table - i cannot fix it at the very top. Of course u can do this in dreamweaver no problems, but not in the visual web developer.

Must be very simple surely? Thx all.

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2007-05-11 : 12:22:54
This is SQL server forum, but you could try something like:
	<table border="1" align="center">
<tr><td> foo </td></tr>
</table>

Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-05-11 : 12:50:51
set cellpadding or cellspacing to 0 in the table tag.


Also, topic moved from New to Sql Server Forum.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

Richy1
Starting Member

27 Posts

Posted - 2007-05-14 : 04:17:28
Thx all, ive managed to get the table to fit into the border, but cant quite get it centred -

<table border="0" cellpadding="0" cellspacing="0" align="center" style="width: 750px; height: 100%; clip: rect(0px 0px 0px 0px); text-align: center; left: 0px; font-family: Arial; position: relative; top: 0px; visibility: visible; background-color: white;">

Tried the align="center" above but doesnt work. Any ideas? thx.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-05-14 : 05:08:14
What are the "CLIP" and "RECT" directives?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Richy1
Starting Member

27 Posts

Posted - 2007-05-14 : 06:50:11
i have absolutely no idea! Ive been trying to get this table centered and somewhere down the line i created that also.....
Go to Top of Page

cvraghu
Posting Yak Master

187 Posts

Posted - 2007-05-14 : 14:52:05
I think 'position', 'top' and 'left' attributes cannot go along with 'align' attribute. Try removing them. I was not able to find any online help wrt this.
Go to Top of Page

Richy1
Starting Member

27 Posts

Posted - 2007-05-15 : 05:07:50
Hmmm, still wont center the table. Has anyone else managed to do that? Heres what i got so far -

<body style="margin: 0px; border-top-style: none; border-right-style: none; border-left-style: none; border-bottom-style: none; background-image: url(images/back.gif);">
<form id="form1" runat="server">
<div style="clip: rect(1px 1px 1px 1px); left: 0px; width: 68px; position: static; top: 0px; height: 72px;" align="center">
<table border="0" cellpadding="0" cellspacing="0" align="center" style="width: 760px; height: 100%; clip: rect(0px 0px 0px 0px); font-family: Arial; background-color: white;">
<tr>
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2007-05-15 : 08:10:25
I still am not sure what you are trying to do, but remember: if you want an element (i.e., a table) to be centered within a parent element (i.e., a DIV or a BODY element), you apply the "text-align: center" style to the PARENT element, not the table itself.

Like this:

<body>
<div style="width: 100%; text-align:center;">

<table width="500px">
.... this table should now be centered on the web page ....
</table>
</div>
</body>




- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

jhermiz

3564 Posts

Posted - 2007-05-15 : 11:52:16
Or the CSS way of doing things is to ensure the style margin-left:auto and margin-right:auto...

the below should really be defined in a css file..but im lazy:


<table width="95%" border="0" cellpadding="0" cellspacing="0" style="margin-left:auto; margin-right:auto;">
...
<tr>
<td>..</td>
</tr>
...
</table>


Programmers HowTo's -- [url]http://jhermiz.googlepages.com[/url]
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2007-05-15 : 12:03:10
I'm pretty sure that my example used CSS ....

Anyway, the margin-left/right: auto is good to know, I was not aware that you could center like that ... very nice!

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page
   

- Advertisement -