i didn't see any html forums so I'm posting this here... what should we use in place of the align tag since it has been deprecated?

i know it has been replaced with css, so how would i convert the following two tags?
<p align="center"> </p>
<td align="center"> </td>

Recommended Answers

All 4 Replies

i didn't see any html forums so I'm posting this here... what should we use in place of the align tag since it has been deprecated?

i know it has been replaced with css, so how would i convert the following two tags?
<p align="center"> </p>
<td align="center"> </td>

You mean like this example?

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

or

<table width="50%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
	<td>&nbsp;</td>
  </tr>
</table>

:?:

Maybe you just need to be alittle more specific. I dunno, its probly just me without coffee today. LOL, let me get some real quick!

well sort of, but the align tag has been deprecated... which means your no longer supposed to be usign it
align <-- cancelled, deleted, removed from HTML 4 (granted browsers still maintain backwards compatibility but nonetheless)

I want to know how to replace the align tag with css which is what they tell you to replace it with.

CSS replacement for the depreciated align tag is text-align

text align in CSS

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

image align in CSS

<div style="text-align: center;"> <img src="imagename.extention"/></div>

table as mikeSQL said:

<table align="center" width="50%"  border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>

Not sure if there is another way of doing this.

SE (Dave)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.