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

M

Mark Rae

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
 
J

Jacob

I prefer to use:
style="margin-left:auto; margin-right:auto;"

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top