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

Attribute 'align' is considered outdated. A newer construct is recommended.

Hi,

I've been asked to "update" an existing fairly simple website to make it
XHTML-compliant i.e.

<!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" >
...
</html>

The site currently makes fairly heavy use of the following tag:

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

This is great because, if the div contains text, it places that text in the
centre of the screen but does not apply any justification to the text
itself. However, as this syntax is deprecated in XHTML, I need to replace
it.

I found the following discussion:
http://www.codecomments.com/ASP_.NET/message713169.html which suggests using
the following tag instead:

<div style="text-align: center;">

However, that not only centres the div, it also centres the text inside it,
which is not what I want. Other sites suggest nesting tables within divs etc
which may or may not be cross-browser compatible.

What is everyone doing for this...?

Any assistance gratefully received.

Mark
Jul 11 '06 #1
2 15465
I prefer to use:
style="margin-left:auto; margin-right:auto;"

Alternatively wrap your div in another div with style="text-align:
center"

Mark Rae wrote:
Hi,

I've been asked to "update" an existing fairly simple website to make it
XHTML-compliant i.e.

<!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" >
...
</html>

The site currently makes fairly heavy use of the following tag:

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

This is great because, if the div contains text, it places that text in the
centre of the screen but does not apply any justification to the text
itself. However, as this syntax is deprecated in XHTML, I need to replace
it.

I found the following discussion:
http://www.codecomments.com/ASP_.NET/message713169.html which suggests using
the following tag instead:

<div style="text-align: center;">

However, that not only centres the div, it also centres the text inside it,
which is not what I want. Other sites suggest nesting tables within divs etc
which may or may not be cross-browser compatible.

What is everyone doing for this...?

Any assistance gratefully received.

Mark
Jul 11 '06 #2
"Jacob" <ja***@reimers.dkwrote in message
news:11**********************@75g2000cwc.googlegro ups.com...
>I prefer to use:
style="margin-left:auto; margin-right:auto;"
OK.
Alternatively wrap your div in another div with style="text-align:
center"
Blimey!
Jul 11 '06 #3

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

Similar topics

8
by: ALI-R | last post by:
How do I allign all my content in aspx page in the middle of page like a lot of websites ? Dose it work with differnet screen resolutions? Thanks for your help.
11
by: Ben Amada | last post by:
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...
6
by: silverbob | last post by:
I am evaluating EWD, which seems to be an improvement over FrontPage. In code view, the program alerts you to items that are not HTML 4.0 compliant. For example, in this line... <td...
2
by: Radu | last post by:
Hi. I have been working at home on a web project (VSNET 2005 SP1). Now I have brought the project at work, and I suddenly have plenty of warnings like: Validation (XHTML 1.0 Transitional) -...
27
by: pamela fluente | last post by:
Hello, for the following code, VS suggests that construct (width= height= ) is out of date and a newer one is recommended: <table><tr><td width="92" height="38" valign="middle">AnyThing</td></...
4
by: Agos | last post by:
Microsoft Visual Studio when I use this tag <br clear="all" /> tells me: Warning 1 Validation (XHTML 1.0 Transitional): Attribute 'clear' is considered outdated. A newer construct is recommended....
13
by: Roderik | last post by:
Hi, I am wondering why (half of the) squared images are not aligned on the right of the text in Internet Explorer (using <img ... align="right" />. I thought this was supported even in IE. In FF...
5
by: rote | last post by:
I have a webpart project i copied across and after setting up in VS 2005 all good. When i go to the design mode and try and autofornat my webpartzone to for example Simple or Professional. The i...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.