473,387 Members | 1,721 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,387 software developers and data experts.

Replacement for <div align="center">

Hello,

When centering a block of HTML, in the past, I've always used:

<div align="center"> ... </div>

However, in VS 2005, I get the following warning:

"Validation (XHTML 1.0 Transitional): Attribute 'align' is considered
outdated. A newer construct is recommended."

What is the newer construct I should use?

Thanks!
Ben
Nov 30 '05 #1
11 25349
<CENTER>...</CENTER>


"Ben Amada" <be*@REpoMOweVErpick.com> wrote in message
news:u$**************@TK2MSFTNGP14.phx.gbl...
Hello,

When centering a block of HTML, in the past, I've always used:

<div align="center"> ... </div>

However, in VS 2005, I get the following warning:

"Validation (XHTML 1.0 Transitional): Attribute 'align' is considered
outdated. A newer construct is recommended."

What is the newer construct I should use?

Thanks!
Ben

Nov 30 '05 #2
Scott M. wrote:
<CENTER>...</CENTER>


Hi Scott,

Are you sure?? Hasn't <center> been deprecated for years now?

Ben
Nov 30 '05 #3
Actually, W3C recommands you to use CSS style(i.e.: style="TEXT-ALIGN:
center") instead.

"Ben Amada" <be*@REpoMOweVErpick.com> ¼¶¼g©ó¶l¥ó·s»D:u$**************@TK2MSFTNGP14.phx.g bl...
Hello,

When centering a block of HTML, in the past, I've always used:

<div align="center"> ... </div>

However, in VS 2005, I get the following warning:

"Validation (XHTML 1.0 Transitional): Attribute 'align' is considered
outdated. A newer construct is recommended."

What is the newer construct I should use?

Thanks!
Ben

Nov 30 '05 #4
Lau Lei Cheong wrote:
Actually, W3C recommands you to use CSS style(i.e.: style="TEXT-ALIGN:
center") instead.


Hi,

Thanks for the tip. Actually, I did try using the text-align style once,
however I ran into a problem where inside the <div> tag, I inserted a
<table> and the table correctly centers in IE, however in Firefox, the table
renders on the left side of the browser. Basically the HTML looks like:

<div style="text-align:center">
<h1>Header</h1>
<table> ... </table>
</div>

The contents of <h1> correctly centers in Firefox, however the entire table
is left-justified.

Any ideas on how to resolve this?

Thanks,
Ben
Nov 30 '05 #5
Ben Amada <be*@REpoMOweVErpick.com> ha scritto:
Any ideas on how to resolve this?

Thanks,
Ben


Try this code:

<div style="text-align:center;">
<h1>Header</h1>
<table style="margin-right: auto; margin-left: auto;">
<tr><td>r1</td></tr>
<tr><td>r2</td></tr>
</table>
</div>

--
AZ [Microsoft - .NET MVP]
Mia Home page: http://ciclismo.sitiasp.it
Asp.Net community: http://www.aspitalia.com
Il mio blog: http://blogs.aspitalia.com/az
--
AZ [Microsoft - .NET MVP]
Mia Home page: http://ciclismo.sitiasp.it
Asp.Net community: http://www.aspitalia.com
Il mio blog: http://blogs.aspitalia.com/az
Nov 30 '05 #6
Yes it has. And so has <FONT> and many other tags, but we use them every
day because they are part of the "HTML 4.01 Transitional" DTD. This is what
"Transitional" means, it means that you can use deprecated code AND CSS. If
you were using "HTML 4.01 Strict", you couldn't do that, but most people use
Transitional because support for the deprecated tags is still very
widespread.

"Ben Amada" <be*@REpoMOweVErpick.com> wrote in message
news:eP*************@TK2MSFTNGP09.phx.gbl...
Scott M. wrote:
<CENTER>...</CENTER>


Hi Scott,

Are you sure?? Hasn't <center> been deprecated for years now?

Ben

Nov 30 '05 #7
Well, Scott, let me remind you that "deprecated" is a word which indicates a
kind of warning, if you will, that something is not going to last. The word
"transitional" indicates that something is being supported during a
transition phase from one set of standards to another, and a transitional
phase lasts only as long as the transition.

Yes, browsers may support this tag (and other deprected tags and elements)
for some years to come, but eventually they will not, and in the meantime,
being deprecated, it (and other deprecated tags) may not work as well over
time, as they come into (possible) conflict with emerging standards.

Bearing this in mind, and being a developer who doesn't want to overburden
himself in the future, while I am not going back over everything I've
created to date and updating it, neither do I want to have to do so all at
one painful whack in the future. So, my personal strategy is to work with
the new standards when I am doing new work, and to avoid deprecated
standards as much as possible. Older work I leave as is, unless I have to do
some maintenance or other upgrade type work on it, in which case I may, if
convenient, do a bit of standards upgrading as well.

Of course, this is not something I am touting as "the right way" or "the
only way" to do things, but I hope you may find it food for thought.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition

"Scott M." <s-***@nospam.nospam> wrote in message
news:ey**************@TK2MSFTNGP09.phx.gbl...
Yes it has. And so has <FONT> and many other tags, but we use them every
day because they are part of the "HTML 4.01 Transitional" DTD. This is
what "Transitional" means, it means that you can use deprecated code AND
CSS. If you were using "HTML 4.01 Strict", you couldn't do that, but most
people use Transitional because support for the deprecated tags is still
very widespread.

"Ben Amada" <be*@REpoMOweVErpick.com> wrote in message
news:eP*************@TK2MSFTNGP09.phx.gbl...
Scott M. wrote:
<CENTER>...</CENTER>


Hi Scott,

Are you sure?? Hasn't <center> been deprecated for years now?

Ben


Nov 30 '05 #8
Yes Kevin, I'm aware of all that. My feeling is that the bulk of the
deprecated tags have been that way for nearly a decade. I can't forsee any
time in the future where an HTML parser won't understand <CENTER> and
<FONT>, it's just not going to happen because of the 100's of millions of
pages that have these tags on them.

This is why we have the choice to use Transitional or Strict. I guess what
I'm saying is that I believe Transitional will be around forever.

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:Ob**************@TK2MSFTNGP10.phx.gbl...
Well, Scott, let me remind you that "deprecated" is a word which indicates
a kind of warning, if you will, that something is not going to last. The
word "transitional" indicates that something is being supported during a
transition phase from one set of standards to another, and a transitional
phase lasts only as long as the transition.

Yes, browsers may support this tag (and other deprected tags and elements)
for some years to come, but eventually they will not, and in the meantime,
being deprecated, it (and other deprecated tags) may not work as well over
time, as they come into (possible) conflict with emerging standards.

Bearing this in mind, and being a developer who doesn't want to overburden
himself in the future, while I am not going back over everything I've
created to date and updating it, neither do I want to have to do so all at
one painful whack in the future. So, my personal strategy is to work with
the new standards when I am doing new work, and to avoid deprecated
standards as much as possible. Older work I leave as is, unless I have to
do some maintenance or other upgrade type work on it, in which case I may,
if convenient, do a bit of standards upgrading as well.

Of course, this is not something I am touting as "the right way" or "the
only way" to do things, but I hope you may find it food for thought.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition

"Scott M." <s-***@nospam.nospam> wrote in message
news:ey**************@TK2MSFTNGP09.phx.gbl...
Yes it has. And so has <FONT> and many other tags, but we use them every
day because they are part of the "HTML 4.01 Transitional" DTD. This is
what "Transitional" means, it means that you can use deprecated code AND
CSS. If you were using "HTML 4.01 Strict", you couldn't do that, but
most people use Transitional because support for the deprecated tags is
still very widespread.

"Ben Amada" <be*@REpoMOweVErpick.com> wrote in message
news:eP*************@TK2MSFTNGP09.phx.gbl...
Scott M. wrote:

<CENTER>...</CENTER>

Hi Scott,

Are you sure?? Hasn't <center> been deprecated for years now?

Ben



Nov 30 '05 #9
Sure Scott. Seems Bill Gates once said that a computer would never need more
than a megabyte of RAM, now that I think of it.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition

"Scott M." <s-***@nospam.nospam> wrote in message
news:ut*************@tk2msftngp13.phx.gbl...
Yes Kevin, I'm aware of all that. My feeling is that the bulk of the
deprecated tags have been that way for nearly a decade. I can't forsee
any time in the future where an HTML parser won't understand <CENTER> and
<FONT>, it's just not going to happen because of the 100's of millions of
pages that have these tags on them.

This is why we have the choice to use Transitional or Strict. I guess
what I'm saying is that I believe Transitional will be around forever.

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:Ob**************@TK2MSFTNGP10.phx.gbl...
Well, Scott, let me remind you that "deprecated" is a word which
indicates a kind of warning, if you will, that something is not going to
last. The word "transitional" indicates that something is being supported
during a transition phase from one set of standards to another, and a
transitional phase lasts only as long as the transition.

Yes, browsers may support this tag (and other deprected tags and
elements) for some years to come, but eventually they will not, and in
the meantime, being deprecated, it (and other deprecated tags) may not
work as well over time, as they come into (possible) conflict with
emerging standards.

Bearing this in mind, and being a developer who doesn't want to
overburden himself in the future, while I am not going back over
everything I've created to date and updating it, neither do I want to
have to do so all at one painful whack in the future. So, my personal
strategy is to work with the new standards when I am doing new work, and
to avoid deprecated standards as much as possible. Older work I leave as
is, unless I have to do some maintenance or other upgrade type work on
it, in which case I may, if convenient, do a bit of standards upgrading
as well.

Of course, this is not something I am touting as "the right way" or "the
only way" to do things, but I hope you may find it food for thought.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition

"Scott M." <s-***@nospam.nospam> wrote in message
news:ey**************@TK2MSFTNGP09.phx.gbl...
Yes it has. And so has <FONT> and many other tags, but we use them
every day because they are part of the "HTML 4.01 Transitional" DTD.
This is what "Transitional" means, it means that you can use deprecated
code AND CSS. If you were using "HTML 4.01 Strict", you couldn't do
that, but most people use Transitional because support for the
deprecated tags is still very widespread.

"Ben Amada" <be*@REpoMOweVErpick.com> wrote in message
news:eP*************@TK2MSFTNGP09.phx.gbl...
Scott M. wrote:

> <CENTER>...</CENTER>

Hi Scott,

Are you sure?? Hasn't <center> been deprecated for years now?

Ben



Nov 30 '05 #10
....And, host programming will be a thing of the past in 5 years (10 years
ago).

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:u5*************@TK2MSFTNGP09.phx.gbl...
Sure Scott. Seems Bill Gates once said that a computer would never need
more than a megabyte of RAM, now that I think of it.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition

"Scott M." <s-***@nospam.nospam> wrote in message
news:ut*************@tk2msftngp13.phx.gbl...
Yes Kevin, I'm aware of all that. My feeling is that the bulk of the
deprecated tags have been that way for nearly a decade. I can't forsee
any time in the future where an HTML parser won't understand <CENTER> and
<FONT>, it's just not going to happen because of the 100's of millions of
pages that have these tags on them.

This is why we have the choice to use Transitional or Strict. I guess
what I'm saying is that I believe Transitional will be around forever.

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:Ob**************@TK2MSFTNGP10.phx.gbl...
Well, Scott, let me remind you that "deprecated" is a word which
indicates a kind of warning, if you will, that something is not going to
last. The word "transitional" indicates that something is being
supported during a transition phase from one set of standards to
another, and a transitional phase lasts only as long as the transition.

Yes, browsers may support this tag (and other deprected tags and
elements) for some years to come, but eventually they will not, and in
the meantime, being deprecated, it (and other deprecated tags) may not
work as well over time, as they come into (possible) conflict with
emerging standards.

Bearing this in mind, and being a developer who doesn't want to
overburden himself in the future, while I am not going back over
everything I've created to date and updating it, neither do I want to
have to do so all at one painful whack in the future. So, my personal
strategy is to work with the new standards when I am doing new work, and
to avoid deprecated standards as much as possible. Older work I leave as
is, unless I have to do some maintenance or other upgrade type work on
it, in which case I may, if convenient, do a bit of standards upgrading
as well.

Of course, this is not something I am touting as "the right way" or "the
only way" to do things, but I hope you may find it food for thought.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition

"Scott M." <s-***@nospam.nospam> wrote in message
news:ey**************@TK2MSFTNGP09.phx.gbl...
Yes it has. And so has <FONT> and many other tags, but we use them
every day because they are part of the "HTML 4.01 Transitional" DTD.
This is what "Transitional" means, it means that you can use deprecated
code AND CSS. If you were using "HTML 4.01 Strict", you couldn't do
that, but most people use Transitional because support for the
deprecated tags is still very widespread.

"Ben Amada" <be*@REpoMOweVErpick.com> wrote in message
news:eP*************@TK2MSFTNGP09.phx.gbl...
> Scott M. wrote:
>
>> <CENTER>...</CENTER>
>
> Hi Scott,
>
> Are you sure?? Hasn't <center> been deprecated for years now?
>
> Ben
>



Dec 1 '05 #11
Andrea Zani wrote:
Try this code:

<div style="text-align:center;">
<h1>Header</h1>
<table style="margin-right: auto; margin-left: auto;">
<tr><td>r1</td></tr>
<tr><td>r2</td></tr>
</table>
</div>


Hi Andrea,

That works great :)

Thank you,
Ben
Dec 1 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jordan Peterson | last post by:
When using {list-style: none} to hide the bullets in a <ul>, the bullets disappear but they are still accounted-for when positioning text. Specifically, I have: <div style='text-align:...
2
by: mstearne | last post by:
Has anyone seen any Javascript that mimics the effect that allows you to browse through the New Releases, Just Added sections of the iTunes Music Store? Where you click the arrow icon and the next...
1
by: melda | last post by:
I am a real beginnner in ASP. Due to increasing demands on dynamic website, I've been working on ASP website now. I use a ready to use CMS program and right now I've been trying to combine a calendar...
3
by: Bill | last post by:
Hi In a css page I have the following: ..OLC{float:left; width:150px;text-align:center; } OL{ list-style-position:inside;} LI{ height:160px;}
3
by: laredotornado | last post by:
Hi, Below I have an unordered list that is displayed on the same horizontal plane (thanks for the help yesterday). What I am wondering now is I would like the contents of the DIV with class...
1
by: nad2zen | last post by:
Hi All, How to set the path value to file object using javascript. now i am trying to upload the file without using browse button, but i could not set the path value.. see my code: <form...
1
by: Webstorm | last post by:
Hi, I hope someone can help me sort this out a bit, Im completely lost. Here is the page I am working on: http://www.knzbusinessbrokers.com/default.asp I have 3 search critera that I need to...
5
by: Jean Pierre Daviau | last post by:
Hi to every one. How can I manage to write this kind of css in a style="". img { width: 150 px; height: 100 px; text-align: center; }
4
by: justice750 | last post by:
Hi All, I am using a FormView control. The allows me to update records in the database. However, when a database field is null I can not update the field on the form. It works fine when the field...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
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,...
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...

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.