Hi all,
This has got to be a dumb question, but... What is the CSS property that I
would use to center a table on the web page?
If I set the table's Align property in the VS 2008 property window it
inserts align="center" into the <tabletag, and I get a validation warning
that attribute 'align' is considered outdated. Ok, so I probably need to
use a CSS style to do the same thing. But I've dug through all of the
categories in the Modify Style dialog and I can't find anything that sets
alignment or position to "center".
TIA - Bob 8 7892
"Bob Altman" <rd*@nospam.nos pamwrote in message
news:er******** ******@TK2MSFTN GP06.phx.gbl...
This has got to be a dumb question, but... What is the CSS property that I
would use to center a table on the web page?
style="margin-left:auto;margi n-right:auto;"
--
Mark Rae
ASP.NET MVP http://www.markrae.net
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
"Bob Altman" <rd*@nospam.nos pamwrote in message
news:er******** ******@TK2MSFTN GP06.phx.gbl...
>This has got to be a dumb question, but... What is the CSS property that I would use to center a table on the web page?
style="margin-left:auto;margi n-right:auto;"
Thanks Mark. That's seriously non-intuitive!
Bob
CSS works on a "box" model, where each element in your page represents a
"box" of space. Every box has a width, interior padding, and exterior
margins.
By setting the margin-left and margin-right CSS properties to "auto", you
are essentially telling the browser to automatically set the margin for you,
but because you did that on both the left and the right, the individual
margins split the difference and you get a left margin and a right margin
that use up whatever space is not being used by your table "box".
-Scott
"Bob Altman" <rd*@nospam.nos pamwrote in message
news:OU******** ******@TK2MSFTN GP02.phx.gbl...
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
>"Bob Altman" <rd*@nospam.nos pamwrote in message news:er******* *******@TK2MSFT NGP06.phx.gbl.. .
>>This has got to be a dumb question, but... What is the CSS property that I would use to center a table on the web page?
style="margi n-left:auto;margi n-right:auto;"
Thanks Mark. That's seriously non-intuitive!
Bob
Hi Bob,
You can use the text-align css propety at the parent container element to
perform horizontal alignment setting: http://www.webmasterworld.com/forum83/4748.htm http://www.ehow.com/how_2284643_left...align-css.html
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at: ms****@microsof t.com.
=============== =============== =============== =====
Get notification to my posts through email? Please refer to http://msdn.microsoft.com/en-us/subs...#notifications.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "Bob Altman" <rd*@nospam.nos pam> Subject: How to center a table? Date: Thu, 28 Aug 2008 09:24:41 -0700
> Hi all,
This has got to be a dumb question, but... What is the CSS property that I would use to center a table on the web page?
If I set the table's Align property in the VS 2008 property window it inserts align="center" into the <tabletag, and I get a validation
warning
>that attribute 'align' is considered outdated. Ok, so I probably need to use a CSS style to do the same thing. But I've dug through all of the categories in the Modify Style dialog and I can't find anything that sets alignment or position to "center".
TIA - Bob
Doesn't that property setting inherit into the cells of the table causing
cell data to also be centered (which may not be desired)?
-Scott
"Steven Cheng [MSFT]" <st*****@online .microsoft.comw rote in message
news:ki******** ******@TK2MSFTN GHUB02.phx.gbl. ..
Hi Bob,
You can use the text-align css propety at the parent container element to
perform horizontal alignment setting:
http://www.webmasterworld.com/forum83/4748.htm
http://www.ehow.com/how_2284643_left...align-css.html
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at: ms****@microsof t.com.
=============== =============== =============== =====
Get notification to my posts through email? Please refer to http://msdn.microsoft.com/en-us/subs...#notifications.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
>>From: "Bob Altman" <rd*@nospam.nos pam> Subject: How to center a table? Date: Thu, 28 Aug 2008 09:24:41 -0700
>> Hi all,
This has got to be a dumb question, but... What is the CSS property that I would use to center a table on the web page?
If I set the table's Align property in the VS 2008 property window it inserts align="center" into the <tabletag, and I get a validation
warning
>>that attribute 'align' is considered outdated. Ok, so I probably need to use a CSS style to do the same thing. But I've dug through all of the categories in the Modify Style dialog and I can't find anything that sets alignment or position to "center".
TIA - Bob
Yes, as I suspected, this does not work. It will center the contents of the
table, but not the table itself.
The correct way is as I've described using margin-left:auto and
margin-right:auto.
-Scott
"Scott M." <s-***@nospam.nosp amwrote in message
news:ue******** ******@TK2MSFTN GP02.phx.gbl...
Doesn't that property setting inherit into the cells of the table causing
cell data to also be centered (which may not be desired)?
-Scott
"Steven Cheng [MSFT]" <st*****@online .microsoft.comw rote in message
news:ki******** ******@TK2MSFTN GHUB02.phx.gbl. ..
>Hi Bob,
You can use the text-align css propety at the parent container element to perform horizontal alignment setting:
http://www.webmasterworld.com/forum83/4748.htm
http://www.ehow.com/how_2284643_left...align-css.html
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: ms****@microsof t.com.
============== =============== =============== ====== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/en-us/subs...#notifications. ============== =============== =============== ====== This posting is provided "AS IS" with no warranties, and confers no rights. --------------------
>>>From: "Bob Altman" <rd*@nospam.nos pam> Subject: How to center a table? Date: Thu, 28 Aug 2008 09:24:41 -0700
>>> Hi all,
This has got to be a dumb question, but... What is the CSS property that I would use to center a table on the web page?
If I set the table's Align property in the VS 2008 property window it inserts align="center" into the <tabletag, and I get a validation
warning
>>>that attribute 'align' is considered outdated. Ok, so I probably need to use a CSS style to do the same thing. But I've dug through all of the categories in the Modify Style dialog and I can't find anything that sets alignment or position to "center".
TIA - Bob
Oops, I mean to say that it will center the table AND the contents of the
table, which may not be desired.
"Scott M." <s-***@nospam.nosp amwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
Yes, as I suspected, this does not work. It will center the contents of
the table, but not the table itself.
The correct way is as I've described using margin-left:auto and
margin-right:auto.
-Scott
"Scott M." <s-***@nospam.nosp amwrote in message
news:ue******** ******@TK2MSFTN GP02.phx.gbl...
>Doesn't that property setting inherit into the cells of the table causing cell data to also be centered (which may not be desired)?
-Scott
"Steven Cheng [MSFT]" <st*****@online .microsoft.comw rote in message news:ki******* *******@TK2MSFT NGHUB02.phx.gbl ...
>>Hi Bob,
You can use the text-align css propety at the parent container element to perform horizontal alignment setting:
http://www.webmasterworld.com/forum83/4748.htm
http://www.ehow.com/how_2284643_left...align-css.html
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: ms****@microsof t.com.
============= =============== =============== ======= Get notification to my posts through email? Please refer to http://msdn.microsoft.com/en-us/subs...#notifications. ============= =============== =============== ======= This posting is provided "AS IS" with no warranties, and confers no rights. -------------------- From: "Bob Altman" <rd*@nospam.nos pam> Subject: How to center a table? Date: Thu, 28 Aug 2008 09:24:41 -0700
Hi all,
This has got to be a dumb question, but... What is the CSS property that I would use to center a table on the web page?
If I set the table's Align property in the VS 2008 property window it inserts align="center" into the <tabletag, and I get a validation warning that attribute 'align' is considered outdated. Ok, so I probably need to use a CSS style to do the same thing. But I've dug through all of the categorie s in the Modify Style dialog and I can't find anything that sets alignment or position to "center".
TIA - Bob
Thanks for your followup Scott,
Yes, I think your suggestion is reasonable. Using Margin will be preferred.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at: ms****@microsof t.com.
--------------------
>From: "Scott M." <s-***@nospam.nosp am> Subject: Re: How to center a table? Date: Fri, 29 Aug 2008 19:30:04 -0400
> Oops, I mean to say that it will center the table AND the contents of the table, which may not be desired.
"Scott M." <s-***@nospam.nosp amwrote in message news:%2******* *********@TK2MS FTNGP03.phx.gbl ...
>Yes, as I suspected, this does not work. It will center the contents of the table, but not the table itself.
The correct way is as I've described using margin-left:auto and margin-right:auto.
-Scott
"Scott M." <s-***@nospam.nosp amwrote in message news:ue******* *******@TK2MSFT NGP02.phx.gbl.. .
>>Doesn't that property setting inherit into the cells of the table
causing
>>cell data to also be centered (which may not be desired)?
-Scott
"Steven Cheng [MSFT]" <st*****@online .microsoft.comw rote in message news:ki****** ********@TK2MSF TNGHUB02.phx.gb l... Hi Bob,
You can use the text-align css propety at the parent container element to perform horizontal alignment setting:
http://www.webmasterworld.com/forum83/4748.htm
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: ajay |
last post by:
I have following code for a slide menu but i twiked it to work for a
single level menu. Open it in a Browser to get a clear picture.
I have 2 Qs
1) How to make first entry as non-link. i.e i want to make first text
as Table Heading/menu category. For examle in the given menu i want to
make a heading as "Comp. Languages" which won't be a link.
2) The position of this menu is absolute to the page. I want to make
it absolute to the Table...
|
by: googley |
last post by:
I'm starting a new thread for a problem that I ran into..
I'm trying to use STYLE SHEETS/CSS to update multiple table widths
across many pages.
I did get it working with one small problem that I can't figure out.
For the sake of being really simple here are the steps i took.
1. create blank web page, create blank css page.
2. save 'em both, link them together.
|
by: Richard |
last post by:
I have a table that is about 100 rows long and within that table I have tons
of links. The table takes about 2 seconds to load. I think javascript might
help somehow.
The problem is that in FireFox and Netscape, as this document is written the
page is being formated while this table is loading, and because the table is
centered horizontally and I have some right-aligned divs above that, the
table will appear to the right side of the...
|
by: lovely_angel_for_you |
last post by:
Hi,
I have following link. By visitng first in IE, and then in Firefox, you
would get to know my issue.
http://lovely.angel.for.you.googlepages.com/test.htm
http://www.geocities.com/lovely_angel_for_you/test.htm
To explain in simple terms, the CSS code that I am using is not
providing the colors to Table backgrounds.
|
by: Mark Rae |
last post by:
Hi,
Consider the following:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
....
....
....
| |
by: Jeff |
last post by:
hey gang. i have a question that is probably simple, and i could do it at
one time, but i forget how.
ok, how to explain
i need to retrieve records from a db. which is no problem. but instead of
displaying them with normal rows, i need to display them across 2 columns,
then down.
here is the example
|
by: nino9stars |
last post by:
Hello,
I have just started messing with absolute positioning on webpages, and
it definitely let's you do some creative things. Well, after much
searching and help, I got the images I was using to overlap correctly.
You can see it on this page:
www.creativekaysjewelry.com
The images overlap exactly how I wanted and in the right position
|
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. Hence the
|
by: RubbedLung |
last post by:
Does anyone know how to get rid of this table offset. I'm using rounded corners and I can't seem to get the bottom to fit together. I've included a picture of the offset and the code. Thanks for your help in advance.
Pic
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><HEAD>
<TITLE>Pine Village Apartments - Lancaster, Ohio</TITLE>
<META name="Hometeam Properties Central...
|
by: Stevo |
last post by:
I've found that for IE6+, if you add the property text-align:center to a
DIV, then *anything* inside it gets centered. That can be a table, an
object/embed, another DIV, an image, or some text.
Firefox and Safari on the other hand don't treat text-align in that way.
In my tests on those browsers, they only centers images and text. Any
DIVs, object/embeds or tables remain default unaligned and generally
appear on the left.
Considering...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |